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)); }
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")); }
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); }
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")); }
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); }