public IActionResult Update([FromBody] ApplicationCore.Entity.Prato prato, int id) { try { if (prato.Id != id) { return(BadRequest()); } _pratoService.Update(prato); return(new OkObjectResult(prato)); } catch (Exception e) { return(new BadRequestResult()); } }
public IActionResult Save([FromBody] ApplicationCore.Entity.Prato prato) { try { if (ModelState.IsValid) { _pratoService.Add(prato); return(new OkObjectResult(prato)); } return(BadRequest(ModelState.ValidationState)); } catch (Exception e) { return(BadRequest(e.Message)); } }