public async Task <IActionResult> PutAmendmentReason([FromRoute] int id, [FromBody] AmendmentReason amendmentReason) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != amendmentReason.ID) { return(BadRequest()); } _context.Entry(amendmentReason).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AmendmentReasonExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostAmendmentReason([FromBody] AmendmentReason amendmentReason) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.AmendmentReasons.Add(amendmentReason); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAmendmentReason", new { id = amendmentReason.ID }, amendmentReason)); }