public async Task <IActionResult> List(SearchListInputModel input) { var salesListViewModel = new SalesListViewModel(); salesListViewModel.Sales = await this.salesService.GetAllBySearchForm(input); return(this.View(salesListViewModel)); }
public IActionResult List(SearchListInputModel input) { var viewModel = new ListViewModel { Recipes = this.recipesService.GetByIngredients <RecipeInListVIewModel>(input.Ingredients), }; return(this.View(viewModel)); }
public IActionResult List(SearchListInputModel input) { var viewModel = new ListViewModel { Competitions = this.competitionService.GetByCategories <CompetitionInListViewModel>(input.Categories), }; return(this.View(viewModel)); }
public IActionResult List(SearchListInputModel input) { var viewModel = new ListViewModel { Products = this.productsService .GetByIngredients <ProductInListViewModel>(input.Ingredients), }; return(this.View(viewModel)); }
public async Task <SearchListInputModel> GetSearchListInputModelWithFilledProperties(int countryId) { var carViewModel = new SearchListInputModel { CountryId = countryId, CategoriesItems = await this.categoriesService.GetAllAsKeyValuePairsAsync(), MakesItems = await this.makesService.GetAllAsKeyValuePairsAsync(), FuelTypeItems = await this.fuelTypesService.GetAllAsKeyValuePairsAsync(), EuroStandartItems = await this.euroStandartsService.GetAllAsKeyValuePairsAsync(), GearboxesItems = await this.gearboxesService.GetAllAsKeyValuePairsAsync(), ColorstItems = await this.colorsService.GetAllAsKeyValuePairsAsync(), CitiesItems = await this.citiesService.GetAllAsKeyValuePairsAsync(countryId), CountriesItems = await this.countriesService.GetAllAsKeyValuePairsAsync(), }; return(carViewModel); }
public IActionResult Increasing(SearchListInputModel input, int page = 1) { if (page <= 0) { return(this.NotFound()); } const int ItemsPerPage = 8; var viewModel = new ProductListViewModel() { ItemsPerPage = ItemsPerPage, PageNumber = page, Count = this.productsService.GetCount(), Products = this.productsService.GetAllIncreasing <ProductInListViewModel>(input.Id, page, ItemsPerPage), }; return(this.View(viewModel)); }
public async Task <IEnumerable <SaleViewModel> > GetAllBySearchForm(SearchListInputModel input) { var sales = this.salesRepository.All() .Where(x => x.CountryId == input.CountryId && x.Images.FirstOrDefault() != null) .Include(x => x.Car) .ToList(); if (input.CityId != null) { sales = sales.Where(x => x.CityId == input.CityId).ToList(); } if (input.CategoryId != null) { sales = sales.Where(x => x.Car.CategoryId == input.CategoryId).ToList(); } if (input.State != null) { sales = sales.Where(x => x.Car.State == input.State).ToList(); } if (input.FuelTypeId != null) { sales = sales.Where(x => x.Car.FuelTypeId == input.FuelTypeId).ToList(); } if (input.GearboxId != null) { sales = sales.Where(x => x.Car.GearboxId == input.GearboxId).ToList(); } if (input.Doors != null) { sales = sales.Where(x => x.Car.Doors == input.Doors).ToList(); } if (input.Seats != null) { sales = sales.Where(x => x.Car.Seats == input.Seats).ToList(); } if (input.MakeId != null) { sales = sales.Where(x => x.Car.MakeId == (int)input.MakeId).ToList(); if (input.ModelId != null) { sales = sales.Where(x => x.Car.MakeId == (int)input.MakeId && x.Car.ModelId == input.ModelId).ToList(); } } if (input.ManufacturerYearFrom != null) { sales = sales.Where(x => x.Car.ManufactureDate.Year >= input.ManufacturerYearFrom).ToList(); } if (input.ManufacturerYearTo != null) { sales = sales.Where(x => x.Car.ManufactureDate.Year <= input.ManufacturerYearTo).ToList(); } if (input.PriceFrom != null) { sales = sales.Where(x => x.Price >= input.PriceFrom).ToList(); } if (input.PriceTo != null) { sales = sales.Where(x => x.Price <= input.PriceTo).ToList(); } if (input.MilleageFrom != null) { sales = sales.Where(x => x.Car.Mileage >= input.MilleageFrom).ToList(); } if (input.MilleageTo != null) { sales = sales.Where(x => x.Car.Mileage <= input.MilleageTo).ToList(); } if (input.EngineSizeFrom != null) { sales = sales.Where(x => x.Car.EngineSize >= input.EngineSizeFrom).ToList(); } if (input.EngineSizeTo != null) { sales = sales.Where(x => x.Car.EngineSize <= input.EngineSizeTo).ToList(); } if (input.PowerFrom != null) { sales = sales.Where(x => x.Car.HorsePower >= input.PowerFrom).ToList(); } if (input.PowerTo != null) { sales = sales.Where(x => x.Car.HorsePower <= input.PowerTo).ToList(); } var salesToShow = new List <SaleViewModel>(); foreach (var sale in sales) { salesToShow.Add(await this.GetSaleInfo(sale.Id)); } return(salesToShow); }