private void PerformSearch(string text) { if (text.Length >= 4) { IsBusy = true; FilteredCustomers = AllCustomerList.Where(x => x.CardName.Contains(text.ToUpper())).OrderBy(x => x.CardName); var pageCount = FilteredCustomers.Count() / 20; if (FilteredCustomers.Count() % 20 != 0) { pageCount = pageCount + 1; } TotalPageCount = pageCount; CurrentPageIndex = 1; RefreshCustomerData(FilteredCustomers); IsBusy = false; } else if (text.Length == 0) { IsBusy = true; CustomerCollection.Clear(); FilteredCustomers = AllCustomerList; RefreshCustomerData(AllCustomerList); IsBusy = false; } }
private async void GetAllCustomer() { Task <List <CustomerModel> > task = Task.Run <List <CustomerModel> >(() => { var t = _customerDataAccess.GetAllData(Properties.Resources.GetAllCustomer); return(t); }); CustomerCollection.Clear(); _log.Message("Getting All Customer from the database"); var _customerCollection = await task; _customerCollection.ForEach(t => CustomerCollection.Add(t)); }