public void Update(long ingid, AdditionalItem item) { AdditionalItem olditem = db.AdditionalItems.Find(ingid); olditem.Name = item.Name; olditem.Image = item.Image; olditem.Price = item.Price; db.SaveChanges(); }
public IActionResult Update(int ingid, AdditionalItem item) { var pizza = db.Find(ingid); if (pizza == null) { return(NotFound()); } db.Update(ingid, item); return(new NoContentResult()); }
public void DelIngridient(long pizzaid, long ingid) { PizzaItem item = db.PizzaItems .Include(p => p.AdditionalIngridients) .Where(p => p.Id == pizzaid) .FirstOrDefault(); AdditionalItem ingridient = db.AdditionalItems.Find(ingid); if (item.AdditionalIngridients.Contains(ingridient)) { item.AdditionalIngridients.Remove(db.AdditionalItems.Find(ingid)); } db.SaveChanges(); }
public void Create(AdditionalItem item) { db.Add(item); }
public void Add(AdditionalItem item) { db.AdditionalItems.Add(item); db.SaveChanges(); }