Пример #1
0
        public ActionResult GetListCustomersFilter(CustomerFilterVM filter)
        {
            if (ModelState.IsValid)
            {
                filter.Letter = filter.Letter == "%" ? string.Empty : filter.Letter;
                int totalPage = 0;
                int pageSize  = CastleClub.BusinessLogic.Data.GlobalParameters.PageSize;
                List <CustomerDT> customersDT = CustomersManager.GetFilterCustomers(filter.Letter, filter.Page, pageSize, filter.Word, filter.All, filter.OnlyActive, filter.SiteName, out totalPage);

                ViewBag.PageCount   = totalPage / pageSize + ((totalPage % pageSize) == 0 ? 0 : 1);
                ViewBag.CurrentPage = filter.All ? 0 : filter.Page;
                customersDT         = customersDT != null ? customersDT : new List <CustomerDT>();
                return(View(customersDT));
            }

            return(View(new List <CustomerDT>()));
        }