public async Task <IActionResult> PutCloracion([FromRoute] int id, [FromBody] Cloracion cloracion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cloracion.Id) { return(BadRequest()); } _context.Entry(cloracion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CloracionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostCloracion([FromBody] Cloracion cloracion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Cloracion.Add(cloracion); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCloracion", new { id = cloracion.Id }, cloracion)); }