public async Task <IHttpActionResult> PutPropertyAgent(int id, PropertyAgent propertyAgent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != propertyAgent.ID) { return(BadRequest()); } db.Entry(propertyAgent).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PropertyAgentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult PropertyApprove(FormCollection id, [Bind(Include = "Id")] PropertyAgent propertyagent) { propertyagent.Prop_Id = Convert.ToInt32(id["Prop_Id"]); db.PropertyAgents.Add(propertyagent); db.SaveChanges(); return(RedirectToAction("Edit", "Properties", new { id = propertyagent.Prop_Id })); }
public async Task <IHttpActionResult> GetPropertyAgent(int id) { PropertyAgent propertyAgent = await db.PropertyAgent.FindAsync(id); if (propertyAgent == null) { return(NotFound()); } return(Ok(propertyAgent)); }
public async Task <IHttpActionResult> PostPropertyAgent(PropertyAgent propertyAgent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PropertyAgent.Add(propertyAgent); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = propertyAgent.ID }, propertyAgent)); }
public async Task <IHttpActionResult> DeletePropertyAgent(int id) { PropertyAgent propertyAgent = await db.PropertyAgent.FindAsync(id); if (propertyAgent == null) { return(NotFound()); } db.PropertyAgent.Remove(propertyAgent); await db.SaveChangesAsync(); return(Ok(propertyAgent)); }