public async Task <IActionResult> PutConsumoAgua([FromRoute] int id, [FromBody] ConsumoAgua consumoAgua) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != consumoAgua.Id) { return(BadRequest()); } _context.Entry(consumoAgua).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ConsumoAguaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostConsumoAgua([FromBody] ConsumoAgua consumoAgua) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ConsumoAgua.Add(consumoAgua); await _context.SaveChangesAsync(); return(CreatedAtAction("GetConsumoAgua", new { id = consumoAgua.Id }, consumoAgua)); }