public IHttpActionResult PutListingModel(int id, ListingModel listingModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != listingModel.Id) { return(BadRequest()); } db.Entry(listingModel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ListingModelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutiMentorUser(int id, iMentorUser iMentorUser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != iMentorUser.Id) { return(BadRequest()); } db.Entry(iMentorUser).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!iMentorUserExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }