public HttpResponseMessage PostClaim(Claim claim) { if (ModelState.IsValid) { try { claimRepository.Insert(claim); } catch(DbUpdateException) { } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, claim); return response; } return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); }
public HttpResponseMessage PutClaim(string id, Claim claim) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } if (id != claim.Name) { return Request.CreateResponse(HttpStatusCode.BadRequest); } return Request.CreateResponse(HttpStatusCode.OK); }