Beispiel #1
0
        public ActionResult List(string Sort = "", string Filter = "")
        {
            if (Filter == "Car" || Filter == "Bus" || Filter == "Truck" || Filter == "Mc" || Filter == "Other")
            {
                return(View(garage.GetFilteredList(Filter)));
            }

            Sort = Sort.ToLower();
            if (Sort == "regnumber")
            {
                return(View(garage.SortReg(false)));
            }
            //else if (Sort == "owner")
            //{
            //    return View(garage.SortOwner(false));
            //}
            else if (Sort == "type")
            {
                return(View(garage.SortType(false)));
            }
            else if (Sort == "parkingplace")
            {
                return(View(garage.SortParking(false)));
            }
            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// Get all Empty ParkingSpots between all vehicles
        /// </summary>
        /// <returns></returns>
        public int[] FreeParkingSpotsBetweenAllCars()
        {
            List <int> spots = new List <int>();
            int        index = 1;

            foreach (var v in garage.SortParking(false))
            {
                if (v.ParkingPlace != index)
                {
                    spots.Add(index);
                }
                index++;
            }
            return(spots.ToArray());
        }