diff --git a/src/Services/RhDatabaseClient.cs b/src/Services/RhDatabaseClient.cs index 8ce88f1..9664361 100644 --- a/src/Services/RhDatabaseClient.cs +++ b/src/Services/RhDatabaseClient.cs @@ -17,9 +17,9 @@ namespace RhSolutions.Services { string request = string.Empty; - if (line.IsRehauSku()) + if (Sku.TryParse(line, out var skus)) { - request = @"https://rh.cebotari.ru/api/products/" + line; + request = @"https://rh.cebotari.ru/api/products/" + skus.FirstOrDefault().ToString(); } else @@ -31,7 +31,7 @@ namespace RhSolutions.Services try { - response.EnsureSuccessStatusCode(); + response.EnsureSuccessStatusCode(); string json = await response.Content.ReadAsStringAsync(); var product = JsonConvert.DeserializeObject>(json) .FirstOrDefault(); @@ -42,14 +42,7 @@ namespace RhSolutions.Services } else { - if (line.IsRehauSku()) - { - return product.Name; - } - else - { - return $"{product.ProductSku} {product.Name}"; - } + return $"{product.ProductSku} {product.Name}"; } } catch