Example #1
0
        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));
        }
Example #2
0
        // 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));
        }
Example #3
0
        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));
        }