diff --git a/Messaging/Messaging.csproj b/Messaging/Messaging.csproj index d1f286bf..bf917c5a 100644 --- a/Messaging/Messaging.csproj +++ b/Messaging/Messaging.csproj @@ -28,7 +28,7 @@ - + diff --git a/Messaging/Program.cs b/Messaging/Program.cs index 9f6574e0..db3f9e72 100644 --- a/Messaging/Program.cs +++ b/Messaging/Program.cs @@ -375,7 +375,7 @@ if (!string.IsNullOrWhiteSpace(msisdn)) { bool checkFrom = PhoneNumbersNA.PhoneNumber.TryParse(msisdn, out var fromPhoneNumber); - if (checkFrom && fromPhoneNumber is not null && !string.IsNullOrWhiteSpace(fromPhoneNumber.DialedNumber)) + if (checkFrom && !string.IsNullOrWhiteSpace(fromPhoneNumber.DialedNumber)) { if (fromPhoneNumber.Type is not PhoneNumbersNA.NumberType.ShortCode) { @@ -404,7 +404,7 @@ { var checkTo = PhoneNumbersNA.PhoneNumber.TryParse(number, out var toPhoneNumber); - if (checkTo && toPhoneNumber is not null) + if (checkTo) { var formattedNumber = toPhoneNumber.Type is PhoneNumbersNA.NumberType.ShortCode ? $"{toPhoneNumber.DialedNumber}" : $"1{toPhoneNumber.DialedNumber}"; // Prevent the duplicates from being included in the the recipients list. @@ -419,7 +419,7 @@ { var checkTo = PhoneNumbersNA.PhoneNumber.TryParse(number, out var toPhoneNumber); - if (checkTo && toPhoneNumber is not null) + if (checkTo) { var formattedNumber = toPhoneNumber.Type is PhoneNumbersNA.NumberType.ShortCode ? $"{toPhoneNumber.DialedNumber}" : $"1{toPhoneNumber.DialedNumber}"; // Prevent the duplicates from being included in the the recipients list. @@ -1177,7 +1177,7 @@ public static async Task, NotFound, BadRequest, NotFound, BadReque try { bool checkFrom = PhoneNumbersNA.PhoneNumber.TryParse(asDialed, out var fromPhoneNumber); - if (checkFrom && fromPhoneNumber is not null && !string.IsNullOrWhiteSpace(fromPhoneNumber.DialedNumber)) + if (checkFrom && !string.IsNullOrWhiteSpace(fromPhoneNumber.DialedNumber)) { if (fromPhoneNumber.Type is not PhoneNumbersNA.NumberType.ShortCode) { @@ -1449,7 +1449,7 @@ public static async Task, BadRequest, BadRequest, BadRequest, Ok, BadRequest, Ok, BadRequest, Ok 1 ? string.Join(",", ToPhoneNumbers.Select(x => $"1{x.DialedNumber!}")) : $"1{ToPhoneNumbers?.FirstOrDefault()?.DialedNumber}" ?? string.Empty : string.Empty; + recip = ToPhoneNumbers is not null && ToPhoneNumbers.Count != 0 ? ToPhoneNumbers.Count > 1 ? string.Join(",", ToPhoneNumbers.Select(x => $"1{x.DialedNumber!}")) : $"1{ToPhoneNumbers?.FirstOrDefault().DialedNumber}" ?? string.Empty : string.Empty; ToParsed = true; } diff --git a/NumberSearch.DataAccess/BulkVS/OrderTn.cs b/NumberSearch.DataAccess/BulkVS/OrderTn.cs index 20c29483..c81213c5 100644 --- a/NumberSearch.DataAccess/BulkVS/OrderTn.cs +++ b/NumberSearch.DataAccess/BulkVS/OrderTn.cs @@ -54,14 +54,14 @@ public static async Task GetAsync(int inNpa, ReadOnlyMemory { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(item.TN, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { output.Add(new PhoneNumber { NPA = phoneNumber.NPA, NXX = phoneNumber.NXX, XXXX = phoneNumber.XXXX, - DialedNumber = phoneNumber?.DialedNumber ?? string.Empty, + DialedNumber = phoneNumber.DialedNumber ?? string.Empty, City = string.IsNullOrWhiteSpace(item.RateCenter) ? "Unknown City" : item.RateCenter, State = string.IsNullOrWhiteSpace(item.State) ? "Unknown State" : item.State, DateIngested = DateTime.Now, @@ -88,14 +88,14 @@ public static async Task GetAsync(int inNpa, int inNxx, ReadOnlyM { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(item.TN, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { output.Add(new PhoneNumber { NPA = phoneNumber.NPA, NXX = phoneNumber.NXX, XXXX = phoneNumber.XXXX, - DialedNumber = phoneNumber?.DialedNumber ?? string.Empty, + DialedNumber = phoneNumber.DialedNumber ?? string.Empty, City = string.IsNullOrWhiteSpace(item.RateCenter) ? "Unknown City" : item.RateCenter, State = string.IsNullOrWhiteSpace(item.State) ? "Unknown State" : item.State, DateIngested = DateTime.Now, diff --git a/NumberSearch.DataAccess/BulkVS/TnRecord.cs b/NumberSearch.DataAccess/BulkVS/TnRecord.cs index e2b77a74..7de2d480 100644 --- a/NumberSearch.DataAccess/BulkVS/TnRecord.cs +++ b/NumberSearch.DataAccess/BulkVS/TnRecord.cs @@ -108,14 +108,14 @@ public static async Task GetAsync(ReadOnlyMemory username, var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(item.TN, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { output.Add(new PhoneNumber { NPA = phoneNumber.NPA, NXX = phoneNumber.NXX, XXXX = phoneNumber.XXXX, - DialedNumber = phoneNumber?.DialedNumber ?? string.Empty, + DialedNumber = phoneNumber.DialedNumber ?? string.Empty, City = string.IsNullOrWhiteSpace(item.TNDetails.RateCenter) ? "Unknown City" : item.TNDetails.RateCenter, State = string.IsNullOrWhiteSpace(item.TNDetails.State) ? "Unknown State" : item.TNDetails.State, DateIngested = DateTime.Now, @@ -145,11 +145,11 @@ public static async Task GetOwnedAsync(ReadOnlyMemory { var checkParsed = PhoneNumbersNA.PhoneNumber.TryParse(item.TN, out var phoneNumber); - if (checkParsed && phoneNumber is not null) + if (checkParsed) { output.Add(new OwnedPhoneNumber { - DialedNumber = phoneNumber?.DialedNumber ?? string.Empty, + DialedNumber = phoneNumber.DialedNumber ?? string.Empty, IngestedFrom = "BulkVS", TrunkGroup = item.Routing.TrunkGroup ?? string.Empty, Active = true, diff --git a/NumberSearch.DataAccess/NumberSearch.DataAccess.csproj b/NumberSearch.DataAccess/NumberSearch.DataAccess.csproj index 4ef624af..4e6169ec 100644 --- a/NumberSearch.DataAccess/NumberSearch.DataAccess.csproj +++ b/NumberSearch.DataAccess/NumberSearch.DataAccess.csproj @@ -24,7 +24,7 @@ - + diff --git a/NumberSearch.Ingest/Owned.cs b/NumberSearch.Ingest/Owned.cs index ebe22420..61acb678 100644 --- a/NumberSearch.Ingest/Owned.cs +++ b/NumberSearch.Ingest/Owned.cs @@ -334,7 +334,7 @@ public static async Task> FirstPointComAsync(ReadO { List numbers = []; - foreach (int npa in AreaCode.All) + foreach (int npa in AreaCodes.All) { try { @@ -346,7 +346,7 @@ public static async Task> FirstPointComAsync(ReadO { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(item.DID, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { numbers.Add(new OwnedPhoneNumber { @@ -551,7 +551,7 @@ public static async Task OfferUnassignedNumberForSaleAsync(Rea { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(item?.DialedNumber ?? string.Empty, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { number = new DataAccess.Models.PhoneNumber { @@ -717,7 +717,7 @@ public static async Task VerifyServiceProvidersAsync(R { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(number.DialedNumber, out var phoneNumber); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { if (phoneNumber.DialedNumber.IsTollfree()) { diff --git a/NumberSearch.Ingest/Provider.cs b/NumberSearch.Ingest/Provider.cs index 3b030190..2be84ba8 100644 --- a/NumberSearch.Ingest/Provider.cs +++ b/NumberSearch.Ingest/Provider.cs @@ -108,7 +108,7 @@ public static async Task BulkVSCompleteAsync(TimeSpan cycle, I Log.Information("Ingesting data from BulkVS"); // Breaking this into chunks to limit peak memory consumption. List allStats = []; - var groups = PhoneNumbersNA.AreaCode.All.Chunk(50); + var groups = PhoneNumbersNA.AreaCodes.All.Chunk(50); foreach (var group in groups) { var BulkVSStats = await Provider.BulkVSAsync(appConfig.BulkVSUsername, appConfig.BulkVSPassword, group, appConfig.Postgresql); @@ -266,7 +266,7 @@ public static async Task FirstPointComCompleteAsync(TimeSpan c // Ingest all available numbers in the FirsPointCom API. Log.Information("[FirstPointCom] Ingesting data from FirstPointCom"); - var FirstPointComStats = await Provider.FirstPointComAsync(appConfig.PComNetUsername, appConfig.PComNetPassword, PhoneNumbersNA.AreaCode.All, appConfig.Postgresql); + var FirstPointComStats = await Provider.FirstPointComAsync(appConfig.PComNetUsername, appConfig.PComNetPassword, PhoneNumbersNA.AreaCodes.All, appConfig.Postgresql); // Remove the lock from the database to prevent it from getting cluttered with blank entries. var lockEntry = await IngestStatistics.GetLockAsync("FirstPointCom", appConfig.Postgresql.ToString()); diff --git a/NumberSearch.Mvc/Controllers/CartAPIController.cs b/NumberSearch.Mvc/Controllers/CartAPIController.cs index 8b1ee299..b5c65938 100644 --- a/NumberSearch.Mvc/Controllers/CartAPIController.cs +++ b/NumberSearch.Mvc/Controllers/CartAPIController.cs @@ -38,9 +38,9 @@ public async Task NumberSearchBulkAsync(string token, string dial // Add portable numbers to cart in bulk if (!string.IsNullOrWhiteSpace(dialedNumber)) { - var parsedNumbers = dialedNumber.ExtractDialedNumbers(); + var parsedNumbers = dialedNumber.ExtractDialedNumbers().ToArray(); - if (!parsedNumbers.Any()) + if (parsedNumbers.Length == 0) { return BadRequest("No dialed phone numbers found. Please try a different query. πŸ₯ΊπŸ‘‰πŸ‘ˆ"); } @@ -812,7 +812,7 @@ public async Task PortPhoneNumberAsync(string dialedPhoneNumber) var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedPhoneNumber, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { // Determine if the number is a wireless number. var lrnLookup = await LrnBulkCnam.GetAsync(phoneNumber.DialedNumber.AsMemory(), _apiKey.AsMemory()); @@ -908,7 +908,7 @@ public async Task VerifyPhoneNumberAsync(string dialedPhoneNumber var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedPhoneNumber, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { try { diff --git a/NumberSearch.Mvc/Controllers/LookupController.cs b/NumberSearch.Mvc/Controllers/LookupController.cs index 6ccc9d61..e374f4bb 100644 --- a/NumberSearch.Mvc/Controllers/LookupController.cs +++ b/NumberSearch.Mvc/Controllers/LookupController.cs @@ -52,9 +52,9 @@ public async Task BulkPortAsync([Bind("dialedNumber")] string dia // Add portable numbers to cart in bulk if (!string.IsNullOrWhiteSpace(dialedNumber)) { - var parsedNumbers = dialedNumber.ExtractDialedNumbers(); + var parsedNumbers = dialedNumber.ExtractDialedNumbers().ToArray(); - if (!parsedNumbers.Any()) + if (parsedNumbers.Length == 0) { return View("Index", new LookupResults { @@ -134,9 +134,9 @@ public async Task ToCSVAsync([Bind("dialedNumber")] string dialed // Add portable numbers to cart in bulk if (!string.IsNullOrWhiteSpace(dialedNumber)) { - var parsedNumbers = dialedNumber.ExtractDialedNumbers(); + var parsedNumbers = dialedNumber.ExtractDialedNumbers().ToArray(); - if (!parsedNumbers.Any()) + if (parsedNumbers.Length == 0) { return View("Index", new LookupResults { @@ -188,7 +188,7 @@ public async Task VerifyPortabilityAsync(string dialedNumber) { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedNumber, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { try { diff --git a/NumberSearch.Mvc/Controllers/PortNotifierController.cs b/NumberSearch.Mvc/Controllers/PortNotifierController.cs index 708b4040..07681d7d 100644 --- a/NumberSearch.Mvc/Controllers/PortNotifierController.cs +++ b/NumberSearch.Mvc/Controllers/PortNotifierController.cs @@ -29,7 +29,7 @@ public async Task IndexAsync(string Query) var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(Query, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { try { diff --git a/NumberSearch.Mvc/Controllers/PortingController.cs b/NumberSearch.Mvc/Controllers/PortingController.cs index bbfcdfb6..83ed893e 100644 --- a/NumberSearch.Mvc/Controllers/PortingController.cs +++ b/NumberSearch.Mvc/Controllers/PortingController.cs @@ -54,7 +54,7 @@ public async Task CheckPortabilityAsync(string Query) var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(Query, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { try { @@ -148,7 +148,7 @@ public async Task RequestPortAsync(string Query) var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(Query, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { var portable = await ValidatePortability.GetAsync(phoneNumber.DialedNumber.AsMemory(), _bulkVSAPIUsername.AsMemory(), _bulkVSAPIPassword.AsMemory()); diff --git a/NumberSearch.Mvc/Controllers/SearchController.cs b/NumberSearch.Mvc/Controllers/SearchController.cs index 311c4a1c..b26e83fa 100644 --- a/NumberSearch.Mvc/Controllers/SearchController.cs +++ b/NumberSearch.Mvc/Controllers/SearchController.cs @@ -70,7 +70,7 @@ public async Task SearchAsync(string query, string city, string f { var checkConvert = int.TryParse(cleanedQuery, out var code); - if (checkConvert && PhoneNumbersNA.AreaCode.All.Contains(code)) + if (checkConvert && PhoneNumbersNA.AreaCodes.All.Contains(code)) { cleanedQuery += "*******"; } diff --git a/NumberSearch.Ops/Controllers/MessagingController.cs b/NumberSearch.Ops/Controllers/MessagingController.cs index d122ded3..5d9dce66 100644 --- a/NumberSearch.Ops/Controllers/MessagingController.cs +++ b/NumberSearch.Ops/Controllers/MessagingController.cs @@ -99,7 +99,7 @@ public async Task RefreshStatusAsync(string dialedNumber) string alertType = "alert-success"; bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedNumber, out var phoneNumber); var token = await GetTokenAsync(); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { var refresh = await $"{_baseUrl}client?asDialed={phoneNumber.DialedNumber}".WithOAuthBearerToken(token.AccessToken).GetJsonAsync(); message = $"πŸ”ƒ Upstream Status {refresh.UpstreamStatusDescription} for {refresh.AsDialed} routed to {refresh.CallbackUrl}"; @@ -138,7 +138,7 @@ public async Task RegisterAsync(string dialedNumber) var result = new MessagingResult { AlertType = "alert-success" }; bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedNumber, out var phoneNumber); var token = await GetTokenAsync(); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { try { @@ -167,7 +167,7 @@ public async Task RegisterAsync(string dialedNumber) } // Refresh the status - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { var refresh = await $"{_baseUrl}client?asDialed={phoneNumber.DialedNumber}".WithOAuthBearerToken(token.AccessToken).GetJsonAsync(); } @@ -220,7 +220,7 @@ public async Task MessagingToEmailAsync([Bind("DialedNumber,Email } bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(toEmail.DialedNumber, out var phoneNumber); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { bool registeredUpstream = false; string upstreamStatusDescription = string.Empty; @@ -346,14 +346,14 @@ public async Task RegisterAsync([Bind("DialedNumber,CallbackUrl,C string alertType = "alert-success"; bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(registrationRequest.DialedNumber, out var phoneNumber); var token = await GetTokenAsync(); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { var request = await $"{_baseUrl}client/register".WithOAuthBearerToken(token.AccessToken).PostJsonAsync(registrationRequest); var response = await request.GetJsonAsync(); message = $"βœ”οΈ Reregistration complete! {response.Message}"; } // Refresh the status - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { var refresh = await $"{_baseUrl}client?asDialed={phoneNumber.DialedNumber}".WithOAuthBearerToken(token.AccessToken).GetJsonAsync(); } @@ -389,7 +389,7 @@ public async Task RemoveAsync(string dialedNumber) var result = new MessagingResult { AlertType = "alert-success" }; bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedNumber, out var phoneNumber); var token = await GetTokenAsync(); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { try { @@ -451,7 +451,7 @@ public async Task TwilioCarrierAsync(string dialedNumber, bool? r { bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(number.AsDialed, out var phoneNumber); bool checkOwned = existing.TryGetValue(phoneNumber.DialedNumber, out var owned); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(number.AsDialed) && checkOwned && string.IsNullOrWhiteSpace(owned?.TwilioCarrierName)) + if (checkParse && !string.IsNullOrWhiteSpace(number.AsDialed) && checkOwned && string.IsNullOrWhiteSpace(owned?.TwilioCarrierName)) { try { @@ -492,7 +492,7 @@ public async Task TwilioCarrierAsync(string dialedNumber, bool? r else { bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedNumber, out var phoneNumber); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) + if (checkParse && !string.IsNullOrWhiteSpace(phoneNumber.DialedNumber)) { try { @@ -651,7 +651,7 @@ public async Task GetCarrierNamesAsync(string carrierName) foreach (var number in existing) { bool checkParse = PhoneNumbersNA.PhoneNumber.TryParse(number.DialedNumber, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { try { diff --git a/NumberSearch.Ops/Controllers/OrdersController.cs b/NumberSearch.Ops/Controllers/OrdersController.cs index ce453c20..15abcf36 100644 --- a/NumberSearch.Ops/Controllers/OrdersController.cs +++ b/NumberSearch.Ops/Controllers/OrdersController.cs @@ -632,7 +632,7 @@ public async Task RegisterE911Async(string serviceNumber, string { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(serviceNumber ?? string.Empty, out var phoneNumber); // Register the number for E911 service. - if (phoneNumber is not null && checkParse) + if (checkParse) { try { diff --git a/NumberSearch.Ops/Controllers/OwnedNumbersController.cs b/NumberSearch.Ops/Controllers/OwnedNumbersController.cs index b03209d6..825b733e 100644 --- a/NumberSearch.Ops/Controllers/OwnedNumbersController.cs +++ b/NumberSearch.Ops/Controllers/OwnedNumbersController.cs @@ -251,7 +251,7 @@ public async Task RegisterE911Async(string dialedNumber, string U } } // Register the number for E911 service. - if (phoneNumber is not null && checkParse && !string.IsNullOrWhiteSpace(UnparsedAddress) && existing is not null) + if (checkParse && !string.IsNullOrWhiteSpace(UnparsedAddress) && existing is not null) { try { diff --git a/NumberSearch.Ops/Controllers/PortRequestsController.cs b/NumberSearch.Ops/Controllers/PortRequestsController.cs index 50f792d3..6235ad83 100644 --- a/NumberSearch.Ops/Controllers/PortRequestsController.cs +++ b/NumberSearch.Ops/Controllers/PortRequestsController.cs @@ -38,7 +38,7 @@ public partial class PortRequestsController(IConfiguration config, numberSearchC { var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(number, out var phoneNumber); - if (checkParse && phoneNumber is not null) + if (checkParse) { try { @@ -299,7 +299,7 @@ public async Task PortRequestUpdate(PortRequestResult result, Gui var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(dialedNumber, out var phoneNumber); - if (portRequest is not null && checkParse && phoneNumber is not null) + if (portRequest is not null && checkParse) { var port = await VerifyPortabilityAsync(phoneNumber.DialedNumber ?? string.Empty); diff --git a/NumberSearch.Ops/Controllers/ProductOrdersController.cs b/NumberSearch.Ops/Controllers/ProductOrdersController.cs index 7746a2b7..3ea0f3de 100644 --- a/NumberSearch.Ops/Controllers/ProductOrdersController.cs +++ b/NumberSearch.Ops/Controllers/ProductOrdersController.cs @@ -103,7 +103,7 @@ public async Task Create([Bind("ProductOrderId,OrderId,ProductId, { var checkNumber = PhoneNumbersNA.PhoneNumber.TryParse(productOrder.DialedNumber, out var number); - if (checkNumber && number is not null) + if (checkNumber) { var checkExists = await _context.ProductOrders.Where(x => x.OrderId == productOrder.OrderId && x.DialedNumber == number.DialedNumber).FirstOrDefaultAsync(); @@ -140,7 +140,7 @@ public async Task Create([Bind("ProductOrderId,OrderId,ProductId, { var checkNumber = PhoneNumbersNA.PhoneNumber.TryParse(productOrder.PortedDialedNumber, out var number); - if (checkNumber && number is not null) + if (checkNumber) { var checkExists = await _context.ProductOrders.Where(x => x.OrderId == productOrder.OrderId && x.PortedDialedNumber == number.DialedNumber).FirstOrDefaultAsync(); @@ -148,7 +148,7 @@ public async Task Create([Bind("ProductOrderId,OrderId,ProductId, { var portRequestsController = new PortRequestsController(_configuration, _context); - var port = await portRequestsController.VerifyPortabilityAsync(number?.DialedNumber ?? string.Empty); + var port = await portRequestsController.VerifyPortabilityAsync(number.DialedNumber ?? string.Empty); if (port.Portable) { @@ -164,7 +164,7 @@ public async Task Create([Bind("ProductOrderId,OrderId,ProductId, await _context.SaveChangesAsync(); } - productOrder.PortedDialedNumber = number?.DialedNumber; + productOrder.PortedDialedNumber = number.DialedNumber; productOrder.PortedPhoneNumberId = port.PortedPhoneNumberId; productOrder.Quantity = 1; _context.Add(productOrder); diff --git a/NumberSearch.Ops/Views/Messaging/Failed.cshtml b/NumberSearch.Ops/Views/Messaging/Failed.cshtml index 0ba2ce8e..df4fec5c 100644 --- a/NumberSearch.Ops/Views/Messaging/Failed.cshtml +++ b/NumberSearch.Ops/Views/Messaging/Failed.cshtml @@ -36,7 +36,7 @@ { var number = failed.FirstOrDefault()?.To; var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(number ?? string.Empty, out var phoneNumber); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(number) && Model is not null) + if (checkParse && !string.IsNullOrWhiteSpace(number) && Model is not null) { var ownedPhoneNumber = Model.Owned.FirstOrDefault(x => x.DialedNumber == phoneNumber.DialedNumber); string AsDialedLink = checkParse && ownedPhoneNumber is not null ? $"{number}" : number; @@ -96,7 +96,7 @@ { var number = failed.FirstOrDefault()?.To; var checkParse = PhoneNumbersNA.PhoneNumber.TryParse(number ?? string.Empty, out var phoneNumber); - if (checkParse && phoneNumber is not null && !string.IsNullOrWhiteSpace(number) && Model is not null) + if (checkParse && !string.IsNullOrWhiteSpace(number) && Model is not null) { var ownedPhoneNumber = Model.Owned.FirstOrDefault(x => x.DialedNumber == phoneNumber.DialedNumber); string AsDialedLink = checkParse && ownedPhoneNumber is not null ? $"{number}" : number;