public IHttpActionResult PutLoanSocial(int id, LoanSocial loanSocial) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != loanSocial.ID) { return(BadRequest()); } db.Entry(loanSocial).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LoanSocialExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetLoanSocial(int id) { LoanSocial loanSocial = db.LoanSocials.Find(id); if (loanSocial == null) { return(NotFound()); } return(Ok(loanSocial)); }
public IHttpActionResult PostLoanSocial(LoanSocial loanSocial) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LoanSocials.Add(loanSocial); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = loanSocial.ID }, loanSocial)); }
public IHttpActionResult DeleteLoanSocial(int id) { LoanSocial loanSocial = db.LoanSocials.Find(id); if (loanSocial == null) { return(NotFound()); } db.LoanSocials.Remove(loanSocial); db.SaveChanges(); return(Ok(loanSocial)); }