public ActionResult Index() { count = ParkingHelper.GetFreeParkingLots(db.Vehicles.ToList()).Count(); if (count == 0) { ViewBag.parkingStatus = "Full"; } else { ViewBag.parkingStatus = count.ToString(); } return(View()); }
// 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)); }