public ActionResult Update(int id, [FromBody] EditOrder order) { if (ModelState.IsValid) { var obj = _orderList.Update(id, order); return(Ok(obj)); } else { return(BadRequest(ModelState)); } }
public IActionResult Update(int id, [FromBody] Order item) { if (item == null || (int)item.Id != id) { return(BadRequest()); } var todo = _orderList.Find(id); if (todo == null) { return(NotFound()); } _orderList.Update(item); return(Ok(item)); }