Try parse sku from input line on Rhsolutions function apply

This commit is contained in:
Sergey Chebotar 2022-12-22 16:00:38 +03:00
parent f267b27375
commit c47301c0db

View File

@ -17,9 +17,9 @@ namespace RhSolutions.Services
{ {
string request = string.Empty; 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 else
@ -41,17 +41,10 @@ namespace RhSolutions.Services
return null; return null;
} }
else else
{
if (line.IsRehauSku())
{
return product.Name;
}
else
{ {
return $"{product.ProductSku} {product.Name}"; return $"{product.ProductSku} {product.Name}";
} }
} }
}
catch catch
{ {
return $"Ошибка сервера {response.StatusCode}"; return $"Ошибка сервера {response.StatusCode}";