public async Task <IActionResult> PutPersonCert([FromRoute] int id, [FromBody] PersonCert personCert) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != personCert.Id) { return(BadRequest()); } _context.Entry(personCert).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonCertExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostPersonCert([FromBody] PersonCert personCert) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.PersonCert.Add(personCert); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPersonCert", new { id = personCert.Id }, personCert)); }