public void ClearSearch(string type) { switch (type) { case "checklist": SearchChecklistText = string.Empty; Checklists.Clear(); _checklistRepository.All().ForEach(c => Checklists.Add(c)); break; case "customer": SearchCustomerText = string.Empty; Customers.Clear(); _customerRepository.All().ForEach(c => Customers.Add(c)); break; case "parkinglot": SearchLocationText = string.Empty; ParkingLots.Clear(); _parkingLotRepository.All().ForEach(p => ParkingLots.Add(p)); break; } SelectFirstComboBoxItem(); }
public void Search(string listType) { if (listType == "checklist") { Checklists.Clear(); _checklistRepository.All() .Where(c => c.Name.ToLower().Contains(SearchChecklistText.ToLower()) || c.Remarks.ToLower().Contains(SearchChecklistText.ToLower()) ).ToList().ForEach(c => Checklists.Add(c)); } else if (listType == "parkinglot") { ParkingLots.Clear(); _parkingLotRepository.All() .Where(p => p.Address.City.ToLower().Contains(SearchLocationText.ToLower()) || p.Address.Country.ToLower().Contains(SearchLocationText.ToLower()) || p.Address.ZipCode.ToLower().Contains(SearchLocationText.ToLower()) || p.Address.Street.ToLower().Contains(SearchLocationText.ToLower()) ).ToList().ForEach(p => ParkingLots.Add(p)); SelectFirstComboBoxItem(); } else if (listType == "customer") { Customers.Clear(); _customerRepository.All() .Where(c => c.Name.ToLower().Contains(SearchCustomerText.ToLower()) || c.Email.ToLower().Contains(SearchCustomerText.ToLower()) || c.Contact.ToLower().Contains(SearchCustomerText.ToLower()) || c.PhoneNumber.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.Street.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.ZipCode.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.City.ToLower().Contains(SearchCustomerText.ToLower()) || c.Address.Country.ToLower().Contains(SearchCustomerText.ToLower()) ).ToList().ForEach(c => Customers.Add(c)); } SelectFirstComboBoxItem(); }