public async Task <IActionResult> PostCharecterCertificate([FromBody] CharecterCertificate charecterCertificate) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CharecterCertificate.Add(charecterCertificate); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCharecterCertificate", new { id = charecterCertificate.AutoId }, charecterCertificate)); }
public async Task <IActionResult> PutCharecterCertificate([FromRoute] int id, [FromBody] CharecterCertificate charecterCertificate) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != charecterCertificate.AutoId) { return(BadRequest()); } _context.Entry(charecterCertificate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CharecterCertificateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }