public CatalogExtendedPagingFilteringModel() { ManufacturerFilter = new ManufacturerFilterModel(); CategoryFilter = new CategoryFilterModel(); ProductAttributeFilter = new AttributeFilterModel(); PriceRangeSliderFilter = new PriceRangeSliderModel(); OuterSorting = ProductOuterSortingEnumAF.None; //PriceRangeSliderItem = new PriceRangeSliderItemModel(); }
public List <CategoryModel> Categories(CategoryFilterModel model) { using (var unitOfWork = _unitOfWorkFactory.Create()) { IEnumerable <Category> categories = unitOfWork.Categories.GetAll(); List <CategoryModel> categoryModels = Mapper.Map <List <CategoryModel> >(categories); return(categoryModels); } }
public ActionResult Index(CategoryFilterModel filterModel) { CategoryIndexViewModel model = new CategoryIndexViewModel() { CategoryList = filterModel.IsFiltered ? _categoryService.Filter(filterModel).ToPagedList() : _categoryService.GetAll().ToPagedList(1, PAGE_SIZE), FilterModel = filterModel, }; return(View(GetIndexViewModel(model))); }
public List <CategoryBasicViewModel> Filter(CategoryFilterModel model) { var items = m_Context.Categories.AsQueryable(); if (model != null) { if (!string.IsNullOrEmpty(model.S_Name)) { items = items.Where(x => x.Name.Contains(model.S_Name)); } if (model.S_PricePerDay != 0) { items = items.Where(x => x.PricePerDay == model.S_PricePerDay); } } return(_mapper.Map <List <CategoryBasicViewModel> >(items.ToList())); }
private CategoryFilterModel PrepareModel(Category category, int currentCategoryId, IList <Category> allCategories) { var categoryFilterModel = new CategoryFilterModel() { Name = category.Name, Url = ApplicationEngine.RouteUrl(RouteNames.ProductsPage, new { seName = category.SeoMeta.Slug, categoryPath = category.GetCategoryPath() }), Selected = category.Id == currentCategoryId, Id = category.Id, ParentId = category.ParentId }; return(categoryFilterModel); }
public IActionResult Index(CategoryFilterModel model) { var models = _categoryService.Categories(model); return(View(models)); }