public IHttpActionResult PostClaimHead(ClaimHead claimHead) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ClaimHeads.Add(claimHead); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = claimHead.id }, claimHead); }
public IHttpActionResult PutClaimHead(int id, ClaimHead claimHead) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != claimHead.id) { return BadRequest(); } db.Entry(claimHead).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClaimHeadExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }