public async Task<object?> MethodFirst(IReadOnlyDictionary<string, object>? data)
{
data = new Dictionary<string, object>();
foreach (var product in Enum.GetValues(typeof(ProductType)))
{
var price = await GetCentreProductSolutionLowestPrice(countryIsoCode3, (ProductType)product, null, context.Culture, cancellationToken).ConfigureAwait(false);
if (string.IsNullOrEmpty(price))
{
return await GetContentById(context, PleaseCallUs, "Please call us", cancellationToken, data);
}
//data.add ?
}
}
data
тип IReadOnlyDictionary - в него нельзя записывать значения.async Task<object?> MethodFirst(IReadOnlyDictionary<string, object>? data)
{
var result = new Dictionary<string, object>();
foreach (var product in Enum.GetValues(typeof(ProductType)))
{
var price = await GetCentreProductSolutionLowestPrice(countryIsoCode3, (ProductType)product, null, context.Culture, cancellationToken).ConfigureAwait(false);
if (string.IsNullOrEmpty(price))
{
return await GetContentById(context, PleaseCallUs, "Please call us", cancellationToken, data);
}
result.Add("some data", new object());
}
return result;
}