private List <Ware> FilteredWares(string searchTerm) { string lowerTerm = searchTerm.ToLower(); //WaresFilter.Where(e => e.Name.ToLower().Contains(searchTerm)) if (!string.IsNullOrWhiteSpace(lowerTerm)) { foreach (Ware w in catalog.AllWares()) { if (w.Name.ToLower().Contains(lowerTerm) && !WaresFilter.Contains(w)) { WaresFilter.Add(w); } } } return(WaresFilter); }
public GetAllWaresModel(IWareCatalog cata, ShoppingCartService cartService, LoginService logService) { catalog = cata; ItemsInCart = cartService; log = logService; LoggedInUser = new User(); IsAdmin = false; WaresFilter = catalog.AllWares(); }
public IActionResult OnGet() { Wares = _wareRepo.AllWares(); Orders = _orderRepo.AllOrders(); Offers = _offerRepo.AllOffers(); if (_loginService.GetLoggedInUser() != null) { if (_loginService.GetLoggedInUser().UserType == UserTypes.Admin) { Users = UserRepo.GetAllUsers(); return(Page()); } } return(RedirectToPage("/Index")); }
public void OnGet() { Wares = catalog.AllWares(); }