public IngridientsAdminViewModelCollection GetIngridientsAdminViewModelCollection() { var result = new IngridientsAdminViewModelCollection(); foreach (var ingridientRow in this.Context.Ingridients) { result.Add(new IngridientsAdminViewModel { Id = ingridientRow.Id, Name = ingridientRow.Name, Description = ingridientRow.Description }); } return result; }
private IngridientsAdminViewModelCollection GetIngridientsModelCollection(int productId) { var result = new IngridientsAdminViewModelCollection(); var ingridients = this.Context.ProductIngridients.Where(p => p.ProductId == productId); foreach (var ingridient in ingridients) { result.Add(new IngridientsAdminViewModel { Id = ingridient.Ingridient.Id, Name = ingridient.Ingridient.Name, Weight = ingridient.Weight }); } return result; }