public IActionResult Update([FromBody] ApplicationCore.Entity.Restaurante restaurante, int id) { try { if (restaurante.Id != id) { return(BadRequest()); } _restauranteService.Update(restaurante); return(new OkObjectResult(restaurante)); //return Ok("Atualizado!"); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult Save([FromBody] ApplicationCore.Entity.Restaurante restaurante) { try { if (ModelState.IsValid) { _restauranteService.Add(restaurante); return(new OkObjectResult(restaurante)); //return new CreatedAtRouteResult("Sucesso!", new { id = restaurante.Id }); } return(BadRequest(ModelState.ValidationState)); } catch (Exception e) { return(BadRequest(e.Message)); } }