public IHttpActionResult PutTenantCarRelationship(int id, [FromBody] TenantCarRelationship tenantCarRelationship) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tenantCarRelationship.relationshipId) { return(BadRequest()); } db.Entry(tenantCarRelationship).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TenantCarRelationshipExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostTenantCarRelationship([FromBody] TenantCarRelationship tenantCarRelationship) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TenantCarRelationships.Add(tenantCarRelationship); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tenantCarRelationship.relationshipId }, tenantCarRelationship)); }
public IHttpActionResult DeleteTenantCarRelationship(int id) { TenantCarRelationship tenantCarRelationship = db.TenantCarRelationships.Find(id); if (tenantCarRelationship == null) { return(NotFound()); } db.TenantCarRelationships.Remove(tenantCarRelationship); db.SaveChanges(); return(Ok(tenantCarRelationship)); }