public async Task <IActionResult> GetCars(int?SearchId, string?SearchMake, string?SearchModel, int?SearchYear, string?SearchColor) { List <Car> cars = null; try { cars = await _DAL.GetCars(SearchId); if (cars != null && SearchMake != null && SearchMake != "") { cars = cars.FindAll(x => x.Make == SearchMake); } if (cars != null && SearchModel != null && SearchModel != "") { cars = cars.FindAll(x => x.Model == SearchModel); } if (cars != null && SearchYear != null) { cars = cars.FindAll(x => x.Year == SearchYear); } if (cars != null && SearchColor != null && SearchColor != "") { cars = cars.FindAll(x => x.Color == SearchColor); } } catch (Exception e) { ViewBag.Result = e.Message; } return(View("Index", cars)); }
public IActionResult Index() { List <Car> cars = car.GetCars(); return(View(cars)); }
public async Task <IActionResult> Index() { List <Car> cars = await carDal.GetCars(); return(View(cars)); }
public async Task <IActionResult> SearchForCars(string Make, string Model, int Year, string Color) { List <Cars> carList = await _car.GetCars(Make, Model, Year, Color); return(View(carList)); }
public IActionResult Data() { List <Cars> cars = cd.GetCars(); return(View(cars)); }
public IActionResult Results(string category, string search) { List <Car> cars = _carDAL.GetCars(category, search); return(View(cars)); }