public async Task <IActionResult> Index(ItemsViewViewModel vm) { vm.CategorySelectList = new MultiSelectList( await _bll.CategoryService.GetAllSubCategoriesAsync(), nameof(Category.Id), nameof(Category.Name)); vm.BrandSelectList = new MultiSelectList( await _bll.BrandService.AllAsync(), nameof(Brand.Id), nameof(Brand.Name)); vm.Items = await _bll.ItemService.AllAsync("", vm.CategoriesFilter, vm.BrandsFilter); return(View(vm)); }
// GET public async Task <IActionResult> Index(string?search = "") { search ??= ""; var vm = new ItemsViewViewModel { Search = search, CategorySelectList = new MultiSelectList( await _bll.CategoryService.GetAllSubCategoriesAsync(), nameof(Category.Id), nameof(Category.Name)), BrandSelectList = new MultiSelectList( await _bll.BrandService.AllAsync(), nameof(Brand.Id), nameof(Brand.Name)) }; vm.Items = await _bll.ItemService.AllAsync(search); return(View(vm)); }
public async Task <IActionResult> Index(Guid?brandId = null) { var vm = new ItemsViewViewModel { CategorySelectList = new MultiSelectList( await _bll.CategoryService.GetAllSubCategoriesAsync(), nameof(Category.Id), nameof(Category.Name)), BrandSelectList = new MultiSelectList( await _bll.BrandService.AllAsync(), nameof(Brand.Id), nameof(Brand.Name)) }; vm.Items = await _bll.ItemService.AllAsync("", null, (brandId == null)?null : new List <Guid> { (Guid)brandId }); return(View(vm)); }