public RecipeDrugModel(RecipeDrug entity) { ID = entity.ID; PackageID = entity.PackageID; Package = new PackageModel(entity.Package); UserID = entity.ClientID; User = new UserModel(entity.Client); MadeByID = entity.MadeByID; MadeBy = entity.MadeBy == null ? null : new EmployeeModel(entity.MadeBy); EvaluatedDate = entity.EvaluatedDate; CreatedDate = entity.CreatedDate; Status = (OrderStatusEnum)entity.StatusID; Ingridients = entity.Ingridients.Select(x => new IngridientModel(x)).ToList() ?? new List <IngridientModel>(5); }
public RecipeDrug ToEntity() { var entity = new RecipeDrug { ID = ID, PackageID = PackageID, Package = Package?.ToEntity(), ClientID = UserID, Client = User?.ToEntity(), MadeByID = MadeByID, MadeBy = MadeBy?.ToEntity(), EvaluatedDate = EvaluatedDate, CreatedDate = CreatedDate, StatusID = (int)Status, Ingridients = Ingridients.Select(x => { var m = x.ToEntity(); m.RecipeDrugID = ID; return(m); }).ToList(), }; return(entity); }