diff --git a/Api.SeaHavenIndustries.Tests/VendorDataServiceTests.cs b/Api.SeaHavenIndustries.Tests/VendorDataServiceTests.cs index 3fe4c0d..3473085 100644 --- a/Api.SeaHavenIndustries.Tests/VendorDataServiceTests.cs +++ b/Api.SeaHavenIndustries.Tests/VendorDataServiceTests.cs @@ -563,6 +563,8 @@ public class VendorDataServiceTests CompanyName = "Addr Co", ContactName = "Pat", Address = "9 Old Street", + City = "Oldtown", + State = "OT", IsActive = true, IsDeleted = false, Company = company @@ -577,6 +579,9 @@ public class VendorDataServiceTests var stale = await service.GetDirectoryPagedAsync(1, 50, search: "9 old street", isActive: true); stale.TotalCount.Should().Be(0); + + var staleCity = await service.GetDirectoryPagedAsync(1, 50, search: "oldtown", isActive: true); + staleCity.TotalCount.Should().Be(0); } [Fact] @@ -600,6 +605,8 @@ public class VendorDataServiceTests { CompanyName = "Addr Only Co", ContactName = "Pat", + City = "Oldtown", + State = "OT", IsActive = true, IsDeleted = false, Company = addressOnlyCompany @@ -621,6 +628,10 @@ public class VendorDataServiceTests var partial = await service.GetDirectoryPagedAsync( 1, 50, isActive: true, locations: new[] { "123 Main" }); partial.TotalCount.Should().Be(0); + + var staleLocation = await service.GetDirectoryPagedAsync( + 1, 50, isActive: true, locations: new[] { "Oldtown, OT" }); + staleLocation.TotalCount.Should().Be(0); } [Fact] diff --git a/SeaHaven.DataServices/Implementation/VendorDataService.cs b/SeaHaven.DataServices/Implementation/VendorDataService.cs index af67ae7..ca6eed2 100644 --- a/SeaHaven.DataServices/Implementation/VendorDataService.cs +++ b/SeaHaven.DataServices/Implementation/VendorDataService.cs @@ -208,12 +208,14 @@ namespace SeaHaven.DataServices.Implementation : v.Address, City = v.Company != null && ((v.Company.City != null && v.Company.City.Trim() != "") || - (v.Company.State != null && v.Company.State.Trim() != "")) + (v.Company.State != null && v.Company.State.Trim() != "") || + (v.Company.Address != null && v.Company.Address.Trim() != "")) ? v.Company.City : v.City, State = v.Company != null && ((v.Company.City != null && v.Company.City.Trim() != "") || - (v.Company.State != null && v.Company.State.Trim() != "")) + (v.Company.State != null && v.Company.State.Trim() != "") || + (v.Company.Address != null && v.Company.Address.Trim() != "")) ? v.Company.State : v.State, Zip = v.Zip,