public async Task <IActionResult> Find(string filter, int?serachType = 1) { List <Customer_Car> model = new List <Customer_Car>(); if (!string.IsNullOrEmpty(filter)) { switch (serachType) { case (int)SearchType.Vin: model = await carService.GetByVin(filter); break; case (int)SearchType.RegNr: model = await carService.GetByRegNumber(filter); break; case (int)SearchType.CustomerName: model = await carService.GetByCustomerName(filter); break; default: model = await carService.GetAll(); break; } } else { model = await carService.GetAll(); } return(PartialView("pwCars", model)); }
static void Do(ICarStatusService carStatusService, ICustomerCarService customerCarService) { for (; ;) { Random rand = new Random(); var statuses = carStatusService.GetAll().Result; var customerCars = customerCarService.GetAll().Result; int statusIndex = GetRandom(statuses, rand); int carIndex = GetRandom(customerCars, rand); var statusToSet = statuses.ElementAt(statusIndex); var carToChange = customerCars.ElementAt(carIndex); customerCarService.UpdateStatus(carToChange.Id, statusToSet.Id); Console.WriteLine(DateTime.Now); Thread.Sleep(3000); } }