//create building
 public ActionResult Create()
 {
     if (LoggedIn.isLoggedIn())
     {
         //giving the values to the viewmodel for show elevator
         BuildingElevator viewmodel = new BuildingElevator();
         viewmodel.Buildings = db.Buildings.ToList();
         return(View(viewmodel));
     }
     else
     {
         return(RedirectToAction("Index", "Error"));
     }
 }
        public ActionResult Show(int id)
        {
            string user = User.Identity.GetUserId();

            if (LoggedIn.isLoggedIn())
            {
                //giving the values to the viewmodel for show elevator
                Elevator         elevator  = db.Elevators.Find(id);
                BuildingElevator viewmodel = new BuildingElevator();
                viewmodel.Elevator = elevator;
                return(View(viewmodel));
            }
            else
            {
                return(RedirectToAction("List", "Elevator"));
            }
        }
        //show the building
        public ActionResult Show(int id)
        {
            string user = User.Identity.GetUserId();

            if (LoggedIn.isLoggedIn())
            {
                string           query     = "select * from Elevators where BuildingId = @id";
                var              Parameter = new SqlParameter("@id", id);
                List <Elevator>  elevators = db.Elevators.SqlQuery(query, Parameter).ToList();
                Building         building  = db.Buildings.Find(id);
                BuildingElevator viewmodel = new BuildingElevator();
                viewmodel.Elevators = elevators;
                viewmodel.Building  = building;
                return(View(viewmodel));
            }
            else
            {
                return(RedirectToAction("List", "Building"));
            }
        }