Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ApartmentStatusTrail apartmentStatusTrail = db.ApartmentStatusTrails.Find(id);

            db.ApartmentStatusTrails.Remove(apartmentStatusTrail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 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));
 }
Пример #3
0
        // 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));
        }
Пример #4
0
        // 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));
        }
Пример #5
0
        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));
        }