public async Task <IActionResult> PutAforo([FromRoute] int id, [FromBody] Aforo aforo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aforo.Id) { return(BadRequest()); } _context.Entry(aforo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AforoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostAforo([FromBody] Aforo aforo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Aforo.Add(aforo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAforo", new { id = aforo.Id }, aforo)); }