示例#1
0
 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());
     }
 }
示例#2
0
 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));
     }
 }