public async Task <IActionResult> PostDeductibleOutOfPocket([FromBody] DeductibleOutOfPocket deductibleOutOfPocket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.DeductibleOutOfPocket.Add(deductibleOutOfPocket); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDeductibleOutOfPocket", new { id = deductibleOutOfPocket.DeductibleId }, deductibleOutOfPocket)); }
public async Task <IActionResult> PutDeductibleOutOfPocket([FromRoute] int id, [FromBody] DeductibleOutOfPocket deductibleOutOfPocket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deductibleOutOfPocket.DeductibleId) { return(BadRequest()); } _context.Entry(deductibleOutOfPocket).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeductibleOutOfPocketExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }