public ContentResult Add([FromBody] BasketPizzaModel model, int user_id) { BasketPizza Bp = new BasketPizza() { User_id = user_id, Count_in = model.Count_in, Pizza_id = model.Pizza_id, }; _context.pizzas_in_basket.Add(Bp); _context.SaveChanges(); return(Content("Added")); }
public ContentResult Delete([FromBody] BasketPizzaModel model, int user_id) { BasketPizza bp = null; foreach (var p in _context.pizzas_in_basket) { if (p.User_id == user_id && p.Pizza_id == model.Pizza_id) { bp = p; break; } } if (bp != null) { _context.pizzas_in_basket.Remove(bp); _context.SaveChanges(); return(Content("succsesfuly")); } return(Content("BAN")); }