/// <summary> /// Inserir SKU do Produto /// </summary> /// <returns></returns> public ProductDetail CreateProductSKU(string token, string id, SkuCreate sku) { try { _logger.LogInformation("Criar SKU - Produto: Enviando requisição para a API"); var response = _ProductApi.CreateProductSKU(token, id, sku).Result; if (!response.IsSuccessStatusCode) { var contentResult = response.Content.ReadAsStringAsync().Result; _logger.LogError($"Criar SKU - Produto: API retornou erro :( - {response.StatusCode}-{response.ReasonPhrase} -> {contentResult}"); if (((int)response.StatusCode) >= 400 && ((int)response.StatusCode) < 500) { return(null); } } _logger.LogInformation("Criar SKU - Produto: API retornou sucesso :)"); var json = response.Content.ReadAsStringAsync().Result; return(Task.Factory.StartNew(() => JsonConvert.DeserializeObject <ProductDetail>(json)).Result); } catch (Exception) { _logger.LogError($"Criar SKU - Produto: API retornou erro :("); return(null); } }