public IActionResult Atualizar([FromBody] JObject restaurante)
 {
     try
     {
         _restauranteService.Atualizar(restaurante.ToObject <Restaurante>());
         return(Ok("Operação realizada com sucesso"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
示例#2
0
        public HttpResponseMessage AtualizarPrato(Restaurante restaurante)
        {
            if (restaurante == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            try
            {
                _restauranteService.Atualizar(restaurante);

                var result = _restauranteService.BuscarTodos().ToList();
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Falha ao atualizar o Restaurante informado."));
            }
        }