public ActionResult DeleteConfirmed(int id) { ApartmentStatusTrail apartmentStatusTrail = db.ApartmentStatusTrails.Find(id); db.ApartmentStatusTrails.Remove(apartmentStatusTrail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ApartmentStatusTrailID,ApartmentID,ApartmentRenteeID,AgentInvolved,StartDate,EndDate")] ApartmentStatusTrail apartmentStatusTrail) { if (ModelState.IsValid) { db.Entry(apartmentStatusTrail).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AgentInvolved = new SelectList(db.Agents, "AgentID", "AgentName", apartmentStatusTrail.AgentInvolved); ViewBag.ApartmentRenteeID = new SelectList(db.ApartmentRentees, "ApartmentRenteeID", "ApartmentRenteeName", apartmentStatusTrail.ApartmentRenteeID); ViewBag.ApartmentID = new SelectList(db.Apartments, "ApartmentID", "ApartmentName", apartmentStatusTrail.ApartmentID); return(View(apartmentStatusTrail)); }
// GET: ApartmentStatusTrails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ApartmentStatusTrail apartmentStatusTrail = db.ApartmentStatusTrails.Find(id); if (apartmentStatusTrail == null) { return(HttpNotFound()); } return(View(apartmentStatusTrail)); }
// GET: ApartmentStatusTrails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ApartmentStatusTrail apartmentStatusTrail = db.ApartmentStatusTrails.Find(id); if (apartmentStatusTrail == null) { return(HttpNotFound()); } ViewBag.AgentInvolved = new SelectList(db.Agents, "AgentID", "AgentName", apartmentStatusTrail.AgentInvolved); ViewBag.ApartmentRenteeID = new SelectList(db.ApartmentRentees, "ApartmentRenteeID", "ApartmentRenteeName", apartmentStatusTrail.ApartmentRenteeID); ViewBag.ApartmentID = new SelectList(db.Apartments, "ApartmentID", "ApartmentName", apartmentStatusTrail.ApartmentID); return(View(apartmentStatusTrail)); }
public ActionResult Create([Bind(Include = "ApartmentStatusTrailID,ApartmentID,ApartmentRenteeID,AgentInvolved,StartDate,EndDate")] ApartmentStatusTrail apartmentStatusTrail) { if (ModelState.IsValid) { //Checkout the apartment from the availability list Apartment changedApt = db.Apartments.Where(v => v.ApartmentID.Equals(apartmentStatusTrail.ApartmentID)).Single(); changedApt.ApartmentStatus = false; db.ApartmentStatusTrails.Add(apartmentStatusTrail); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AgentInvolved = new SelectList(db.Agents, "AgentID", "AgentName", apartmentStatusTrail.AgentInvolved); ViewBag.ApartmentRenteeID = new SelectList(db.ApartmentRentees, "ApartmentRenteeID", "ApartmentRenteeName", apartmentStatusTrail.ApartmentRenteeID); ViewBag.ApartmentID = new SelectList(db.Apartments, "ApartmentID", "ApartmentName", apartmentStatusTrail.ApartmentID); return(View(apartmentStatusTrail)); }