示例#1
0
        public ActionResult Search(string keywords)
        {
            string searchKey = CleanString.InputText(keywords, 100);

            if (searchKey != "")
            {
                // Create a data cache key
                // If that data is not in the cache then use the business logic tier to fetch the data
                ProductBO           product          = new ProductBO();
                IList <ProductInfo> productsBySearch = product.GetProductsBySearch(searchKey);
                // Store the results in a cache
                return(View(productsBySearch));
            }
            return(View());
        }
示例#2
0
        public ActionResult ShoppingCart(string Id)
        {
            CartController cartController = new CartController();
            Cart           myCart         = cartController.GetCart(true);

            AccountController accountController = new AccountController();

            //Get the user's favourite category
            string favCategory = accountController.GetFavouriteCategory();

            //If we have a favourite category, render the favourites list
            ViewBag.Favourite = favCategory;

            if (Id != null)
            {
                // Clean the input string
                Id = CleanString.InputText(Id, 50);
                myCart.Add(Id);
                cartController.StoreCart(myCart);
            }

            return(View(myCart));
        }