public CustomerGrid GetAllCustomers(CustomerSearchObject searchObject) { var gridPageSize = searchObject.PageSize ?? Utility.PageSize; var customerService = CustomerService.GetInstance(); int totalCount = 0; var navigationList = new List <Navigations> { Navigations.City, }; var data = (from c in customerService.GetDefaultQuery(searchObject, navigationList, out totalCount) select new CustomerViewModel { Id = c.Id, FullName = c.FullName, ManagerName = c.ManagerName, Mobile = c.Mobile, City = c.City, }); var gridData = new CustomerGrid { CustomerList = data.ToList(), PageCount = Utility.CalculatePageSize(totalCount, gridPageSize), PageSize = gridPageSize }; return(gridData); }
public ActionResult Search(int?pageNumber = 1) { var searchObject = new CustomerSearchObject { }; LogManagement.Logging($"Search Customers from list", (int)LogType.Info, "Search Customers", "CustomersController/SearchAction"); var data = GetAllCustomers(searchObject); return(Json(data, JsonRequestBehavior.AllowGet)); //message }
public List <Customer> GetDefaultQuery(CustomerSearchObject searchObbject, List <Navigations> navigations, out int totalCount) { return(_repository.GetDefaultQuery(searchObbject, navigations, out totalCount).ToList()); }