public IHttpActionResult PutOwnerPropertyDescription(int id, OwnerPropertyDescription ownerPropertyDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ownerPropertyDescription.OwnerPropertyId) { return(BadRequest()); } db.Entry(ownerPropertyDescription).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!OwnerPropertyDescriptionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetOwnerPropertyDescription(int id) { OwnerPropertyDescription ownerPropertyDescription = db.OwnerPropertyDescriptions.Find(id); if (ownerPropertyDescription == null) { return(NotFound()); } return(Ok(ownerPropertyDescription)); }
public IHttpActionResult PostOwnerPropertyDescription(OwnerPropertyDescription ownerPropertyDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ownerPropertyDescription.RegistrationDate = DateTime.Now; db.OwnerPropertyDescriptions.Add(ownerPropertyDescription); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = ownerPropertyDescription.OwnerPropertyId }, ownerPropertyDescription)); }
public IHttpActionResult DeleteOwnerPropertyDescription(int id) { OwnerPropertyDescription ownerPropertyDescription = db.OwnerPropertyDescriptions.Find(id); if (ownerPropertyDescription == null) { return(NotFound()); } db.OwnerPropertyDescriptions.Remove(ownerPropertyDescription); db.SaveChanges(); return(Ok(ownerPropertyDescription)); }