/// <summary> /// Método responsável por alterar um RestauranteHistorico /// </summary> /// <param name="restauranteHistorico">Objeto RestauranteHistorico</param> /// <returns>Objeto RestauranteHistorico</returns> public async Task <RestauranteHistorico> PutRestauranteHistoricoAsync(RestauranteHistorico restauranteHistorico) { try { _dbContext.SetModified(restauranteHistorico); await _dbContext.SaveChangesAsync(); return(restauranteHistorico); } catch (Exception ex) { throw ex; } }
/// <summary> /// Método responsável por inserir um novo RestauranteHistorico /// </summary> /// <param name="restauranteHistorico">Objeto RestauranteHistorico</param> /// <returns>Objeto RestauranteHistorico</returns> public async Task <RestauranteHistorico> PostRestauranteHistoricoAsync(RestauranteHistorico restauranteHistorico) { try { if (!restauranteHistorico.ValidarEntidade()) { throw new Exception("Restaurante histórico inválido."); } _dbContext.Add(restauranteHistorico); await _dbContext.SaveChangesAsync(); return(restauranteHistorico); } catch (Exception ex) { throw ex; } }