public void DishIngredientDelete(DishIngredient item) { try { DishIngredientList.Attach(item); DishIngredientList.Remove(item); this.SaveChanges(); } catch (Exception e) { Console.WriteLine(e); throw; } }
public void DishIngredientChange(DishIngredient item) { try { var ser = DishIngredientList.Where(x => x.Id == item.Id).First(); ser.Quantity = item.Quantity; ser.IngredientsId = item.IngredientsId; ser.DishId = item.DishId; this.SaveChanges(); } catch (Exception e) { Console.WriteLine(e); throw; } }