public IActionResult AddItem(int id, [FromBody] Item item) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var orderService = new DatabaseService(context); var order = orderService.FindOrder(id); if (order == null) { return(NotFound()); } orderService.AddItem(order, item); return(Ok()); }
public void AddItem() { database.AddItem(); SetDisplayItem(); }