using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace GreenTree.Nachtragsmanagement.Web.Models.Deviation { public class KindDataModel { public int Id { get; set; } public string Description { get; set; } public string Shortance { get; set; } public bool IsDefault { get; set; } public static KindDataModel FromKind(Core.Domain.Deviation.Kind kindEntity, bool newWhenIsNull) { if (kindEntity == null && newWhenIsNull) return new KindDataModel { Id = -1 }; if (kindEntity == null && !newWhenIsNull) throw new ArgumentNullException("kindEntity", "Cannot create KindDataModel from NULL kind entity."); return new KindDataModel { Id = kindEntity.Id, Description = kindEntity.Description, Shortance = kindEntity.Shortance, IsDefault = kindEntity.IsDefault }; } public Core.Domain.Deviation.Kind ToKind() { return new Core.Domain.Deviation.Kind { Id = this.Id, Description = this.Description, Shortance = this.Shortance, IsDefault = this.IsDefault }; } } }