public IHttpActionResult PutPropertyTaskDetail(int id, PropertyTaskDetail propertyTaskDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != propertyTaskDetail.Id) { return(BadRequest()); } db.Entry(propertyTaskDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PropertyTaskDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPropertyTaskDetail(int id) { PropertyTaskDetail propertyTaskDetail = db.PropertyTaskDetails.Find(id); if (propertyTaskDetail == null) { return(NotFound()); } return(Ok(propertyTaskDetail)); }
public IHttpActionResult PostPropertyTaskDetail(PropertyTaskDetail propertyTaskDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PropertyTaskDetails.Add(propertyTaskDetail); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = propertyTaskDetail.Id }, propertyTaskDetail)); }
public IHttpActionResult DeletePropertyTaskDetail(int id) { PropertyTaskDetail propertyTaskDetail = db.PropertyTaskDetails.Find(id); if (propertyTaskDetail == null) { return(NotFound()); } db.PropertyTaskDetails.Remove(propertyTaskDetail); db.SaveChanges(); return(Ok(propertyTaskDetail)); }