public int Put(int id, RestauranteNG restaurante) { try { return(_rest.Update(id, restaurante)); } catch (Exception e) { throw e; } }
public IActionResult UpdateRestaurante([FromBody] Restaurante restaurante) { try { Restaurante rest = repo.GetById(restaurante.Id); rest.Nome = restaurante.Nome; repo.Update(rest); } catch (System.NullReferenceException ex) { return(NotFound()); } catch (Exception ex) { return(BadRequest(ex.InnerException.Message)); } return(Ok("Ok")); }