using GreenTree.Strohrmann.ERP.Core.Domain.Business; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; namespace GreenTree.Strohrmann.ERP.Web.Models.Business { public class CraftModel { #region Properties /// /// Craft id /// [Display(Name = "ID")] public int Id { get; set; } /// /// Craft name /// [Display(Name = "Name")] public string Name { get; set; } /// /// Craft creation date /// [Display(Name = "Gestartet am")] public DateTime CreationDate { get; set; } /// /// Craft customer /// [Display(Name = "Kunde")] public CustomerModel Customer { get; set; } /// /// Craft employees /// [Display(Name = "Stunden")] public List CraftEmployees { get; set; } /// /// Craft materials /// [Display(Name = "Material")] public List CraftMaterials { get; set; } #endregion #region Ctor /// /// Initializes a new instance of the CraftModel class /// public CraftModel() { } /// /// Initializes a new instance of the CraftModel class /// /// The base craft. public CraftModel(Craft craft) { if (craft == null) return; Id = craft.Id; Name = craft.Name; CreationDate = craft.CreationDate; Customer = new CustomerModel(craft.Customer); CraftEmployees = craft.CraftEmployees .Select(ce => new CraftEmployeeModel(ce)) .ToList(); CraftMaterials = craft.CraftMaterials .Select(cm => new CraftMaterialModel(cm)) .ToList(); } #endregion } }