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 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); }