public async Task <IActionResult> PutCompetidorModel([FromRoute] int id, [FromBody] CompetidorModel competidorModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != competidorModel.Id) { return(BadRequest()); } _context.Entry(competidorModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompetidorModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostCompetidorModel([FromBody] CompetidorModel competidorModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Competidores.Add(competidorModel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCompetidorModel", new { id = competidorModel.Id }, competidorModel)); }