Exemple #1
0
        public async Task <IActionResult> openBlockedList()
        {
            BlockListVM vm = getPersistantData <BlockListVM>();

            vm.blockList = await BlockList.getList(Models.User.current);

            setPersistantData(vm);
            return(View("~/Offers/Views/BlockedItemCategoryList.cshtml", vm));
        }
Exemple #2
0
        public IActionResult filter(List <string> filter_categories)
        {
            BlockListVM vm = getPersistantData <BlockListVM>();

            if (vm.items != null)
            {
                vm = applyFilters(vm, filter_categories);
                setPersistantData(vm);
            }

            return(RedirectToAction("Index"));
        }
Exemple #3
0
 private BlockListVM applyDefaultFilters(BlockListVM vm)
 {
     if (vm.items.Any(i => i.category.ToLower().CompareTo("sex") == 0))
     {
         vm.hiddenCategories = new HashSet <string> {
             "sex"
         };
     }
     else
     {
         vm.hiddenCategories = new HashSet <string>();
     }
     return(vm);
 }
Exemple #4
0
        public async Task <IActionResult> openItemList()
        {
            BlockListVM vm = getPersistantData <BlockListVM>();

            vm.items = await ItemsAPI.getItems();

            if (vm.hiddenCategories == null)
            {
                vm = applyDefaultFilters(vm);
            }

            setPersistantData(vm);
            return(RedirectToAction("Index"));
        }
Exemple #5
0
 private BlockListVM applyFilters(BlockListVM vm, List <string> filter_categories)
 {
     vm.hiddenCategories = new HashSet <string>(vm.items.Select(i => i.category.ToLower()).Distinct().Except(filter_categories));
     return(vm);
 }