public List <Tenant> SearchForTenantByName(string firstNameToSearch) { var result = new List <Tenant>(); var lowerCaseSearch = firstNameToSearch.ToLower(); var tenants = _tenantStorageList.GetAll(); foreach (var tenant in tenants) { var lowerCaseFirstName = tenant.FirstName.ToLower(); // if (lowerCaseFirstName.Contains(lowerCaseSearch)){ // result.Add(tenant); // } if (lowerCaseFirstName.StartsWith(lowerCaseSearch)) { result.Add(tenant); } } return(result); }
//method to print all the tenants public List <Tenant> PrintAllTenants() { return(_tenantStorageList.GetAll()); }