public IHttpActionResult PostJusInterest(JusInterest jusInterest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.JusInterests.Add(jusInterest); try { db.SaveChanges(); } catch (DbUpdateException) { if (JusInterestExists(jusInterest.InterestCode)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = jusInterest.InterestCode }, jusInterest)); }
public IHttpActionResult PutJusInterest(string id, JusInterest jusInterest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jusInterest.InterestCode) { return(BadRequest()); } db.Entry(jusInterest).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JusInterestExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetJusInterest(string id) { JusInterest jusInterest = db.JusInterests.Find(id); if (jusInterest == null) { return(NotFound()); } return(Ok(jusInterest)); }
public IHttpActionResult DeleteJusInterest(string id) { JusInterest jusInterest = db.JusInterests.Find(id); if (jusInterest == null) { return(NotFound()); } db.JusInterests.Remove(jusInterest); db.SaveChanges(); return(Ok(jusInterest)); }