コード例 #1
0
        public IActionResult Index()
        {
            var viewModel = new SearchFiltersInputModel
            {
                CarManufacturers = this.carsService.GetAllCarManufacturersAsKeyValuePairs(),
                CarTypes         = this.carsService.GetAllCarTypesAsKeyValuePairs(),
                Categories       = this.autopartsCharacteristicsService.GetAllAutopartCategories().Select(x => new KeyValuePair <string, string>(x.Id.ToString(), x.Value)),
                Conditions       = this.autopartsCharacteristicsService.GetAllAutopartConditions().Select(x => new KeyValuePair <string, string>(x.Id.ToString(), x.Value)),
            };

            return(this.View(viewModel));
        }
コード例 #2
0
        public IActionResult Result(SearchFiltersInputModel searchFilters)
        {
            var searchFiltersDTO = new SearchFiltersDTO
            {
                MaxPrice          = searchFilters.MaxPrice,
                ConditionId       = searchFilters.ConditionId,
                CategoryId        = searchFilters.CategoryId,
                CarManufacturerId = searchFilters.CarManufacturerId,
                ModelId           = searchFilters.ModelId,
                CarTypeId         = searchFilters.CarTypeId,
                CarMakeYear       = searchFilters.CarMakeYear,
            };

            var viewModel = this.autopartsService.GetAll <AutopartsListItemViewModel>(searchFiltersDTO);

            return(this.View(viewModel));
        }