public IHttpActionResult PutPropertyTaskHeader(int id, PropertyTaskHeader propertyTaskHeader) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != propertyTaskHeader.Id) { return(BadRequest()); } db.Entry(propertyTaskHeader).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PropertyTaskHeaderExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPropertyTaskHeader(int id) { PropertyTaskHeader propertyTaskHeader = db.PropertyTaskHeaders.Find(id); if (propertyTaskHeader == null) { return(NotFound()); } return(Ok(propertyTaskHeader)); }
public IHttpActionResult PostPropertyTaskHeader(PropertyTaskHeader propertyTaskHeader) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PropertyTaskHeaders.Add(propertyTaskHeader); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = propertyTaskHeader.Id }, propertyTaskHeader)); }
public IHttpActionResult DeletePropertyTaskHeader(int id) { PropertyTaskHeader propertyTaskHeader = db.PropertyTaskHeaders.Find(id); if (propertyTaskHeader == null) { return(NotFound()); } db.PropertyTaskHeaders.Remove(propertyTaskHeader); db.SaveChanges(); return(Ok(propertyTaskHeader)); }