Example #1
0
        public ActionResult Search(string Category = "전체", string ProductName = "", int page = 1)
        {
            int pageSize = 10000;

            DataTable dt = dac.SelectAllProducts(Category, page, pageSize);

            List <ProductList> list = SqlHelper.ConvertDataTableToList <ProductList>(dt);

            var SortedList = (from items in list
                              where items.Product_Name.Contains(ProductName)
                              select items).ToList();


            ProductListViewModel model = new ProductListViewModel
            {
                ComboList  = dac.GetComboList(),
                Products   = SortedList,
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = page,
                    ItemsPerPage = pageSize,
                    TotalItems   = dac.GetTotalCount(Category)
                },
                CurrentCategory = Category
            };

            return(View(model));
        }