예제 #1
0
        public IActionResult UsersAllProduct()
        {
            var result = new AllUsersProductViewModel()
            {
                All = this.userServices.AllProducts()
            };

            return(View(result));
        }
예제 #2
0
        public IActionResult SearchProduct(string searchString)
        {
            if (!String.IsNullOrEmpty(searchString))
            {
                var result = new AllUsersProductViewModel()
                {
                    All = this.userServices.SearchProducts(searchString)
                };

                if (result == null)
                {
                    TempData["Error"] = "The product is not find";
                    return(RedirectToAction(nameof(UsersAllProduct)));
                }
                return(View("UsersAllProduct", result));
            }

            this.TempData["Error"] = " The search string is null or empty !!!!";
            return(RedirectToAction(nameof(UsersAllProduct)));
        }