public IHttpActionResult PostClaimLine(ClaimLine claimLine) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ClaimLines.Add(claimLine); try { db.SaveChanges(); } catch (DbUpdateException) { if (ClaimLineExists(claimLine.Id)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = claimLine.Id }, claimLine); }
public IHttpActionResult PutClaimLine(int id, ClaimLine claimLine) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != claimLine.Id) { return BadRequest(); } db.Entry(claimLine).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClaimLineExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }