コード例 #1
0
        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();
        }
コード例 #2
0
        public IActionResult Update(int ingid, AdditionalItem item)
        {
            var pizza = db.Find(ingid);

            if (pizza == null)
            {
                return(NotFound());
            }

            db.Update(ingid, item);
            return(new NoContentResult());
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 public void Create(AdditionalItem item)
 {
     db.Add(item);
 }
コード例 #5
0
 public void Add(AdditionalItem item)
 {
     db.AdditionalItems.Add(item);
     db.SaveChanges();
 }