예제 #1
0
        public ActionResult Index()
        {
            count = ParkingHelper.GetFreeParkingLots(db.Vehicles.ToList()).Count();

            if (count == 0)
            {
                ViewBag.parkingStatus = "Full";
            }
            else
            {
                ViewBag.parkingStatus = count.ToString();
            }

            return(View());
        }
예제 #2
0
        // GET: Vehicles/Create
        public ActionResult Create()
        {
            var vehicles = db.Vehicles.ToList();
            int count    = ParkingHelper.GetFreeParkingLots(vehicles).Count();

            if (count == 0)
            {
                return(RedirectToAction("Error"));
            }

            var createViewModel = new VehicleCreateViewModel
            {
                FreeParking     = new SelectList(ParkingHelper.GetFreeParkingLots(vehicles)),
                VehicleTypeList = new SelectList(db.VehicleTypes.ToList(), "Id", "Name"),
                MemberList      = new SelectList(db.Members.ToList(), "MemberId", "FullName"), //We dont really want to do this, but this is an experiment
            };

            return(View(createViewModel));
        }