public async Task <IHttpActionResult> PutPropertyInterestedUser(int id, PropertyInterestedUser propertyInterestedUser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != propertyInterestedUser.ID) { return(BadRequest()); } db.Entry(propertyInterestedUser).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PropertyInterestedUserExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetPropertyInterestedUser(int id) { PropertyInterestedUser propertyInterestedUser = await db.PropertyInterestedUser.FindAsync(id); if (propertyInterestedUser == null) { return(NotFound()); } return(Ok(propertyInterestedUser)); }
public async Task <IHttpActionResult> PostPropertyInterestedUser(PropertyInterestedUser propertyInterestedUser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PropertyInterestedUser.Add(propertyInterestedUser); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = propertyInterestedUser.ID }, propertyInterestedUser)); }
public async Task <IHttpActionResult> DeletePropertyInterestedUser(int id) { PropertyInterestedUser propertyInterestedUser = await db.PropertyInterestedUser.FindAsync(id); if (propertyInterestedUser == null) { return(NotFound()); } db.PropertyInterestedUser.Remove(propertyInterestedUser); await db.SaveChangesAsync(); return(Ok(propertyInterestedUser)); }