public async Task <IActionResult> PutPartia([FromRoute] int id, [FromBody] Partia partia) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != partia.IdPartia) { return(BadRequest()); } _context.Entry(partia).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PartiaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostPartia([FromBody] Partia partia) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Partia.Add(partia); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPartia", new { id = partia.IdPartia }, partia)); }