C
Carneno
Guest
Hello,
I have an Asp.Net, Core 2.1, MVC, C# Web application in Visual Studio 2017 15.7.5.
I have this code:
var model = new AccessModel();
model.UserAccessModel = _context.UserAccessModels.Single(a => a.ID == 1);
var accessToken = (model.UserAccessModel.AccessToken ?? TempData["accessToken"]).ToString();
var serverUrl = (model.UserAccessModel.ServerUrl ?? TempData["serverUrl"]).ToString();
var nopApiClient = new ApiClient(accessToken, serverUrl);
MultipleProductModel multipleProductModel = new MultipleProductModel();
List<Category> categories = new List<Category>();
string jsonUrl = $"/api/products/count";
object productsCount = nopApiClient.Get(jsonUrl);
var nopProductsCount = JsonConvert.DeserializeObject<ProductsCount>(productsCount.ToString());
int sinceID = 0;
do
{
jsonUrl = $"/api/products?limit=250&since_id=" + sinceID.ToString() + $"&fields=id,sku,name,images,categories";
object productsData = nopApiClient.Get(jsonUrl);
var productsRootObject = JsonConvert.DeserializeObject<ProductsRootObject>(productsData.ToString());
multipleProductModel.MProductsApi.AddRange(productsRootObject.Products);
var last = multipleProductModel.MProductsApi.LastOrDefault();
sinceID = Convert.ToInt16(last.Id);
} while (multipleProductModel.MProductsApi.Count < nopProductsCount);
public class ProductsCount
{
public int Count { get; set; }
}
Why won't it allow me to use nopProductsCount on the while line?
It gives this error:
error CS0019: Operator '<' cannot be applied to operands of type 'int' and 'ProductListViewComponent.ProductsCount'
Thanks,
Tony
Stop The World, I want To Get Off! ........... Life Isn't About Waiting For The Storm To Pass ... It's About Learning To Dance In The Rain.
Continue reading...
I have an Asp.Net, Core 2.1, MVC, C# Web application in Visual Studio 2017 15.7.5.
I have this code:
var model = new AccessModel();
model.UserAccessModel = _context.UserAccessModels.Single(a => a.ID == 1);
var accessToken = (model.UserAccessModel.AccessToken ?? TempData["accessToken"]).ToString();
var serverUrl = (model.UserAccessModel.ServerUrl ?? TempData["serverUrl"]).ToString();
var nopApiClient = new ApiClient(accessToken, serverUrl);
MultipleProductModel multipleProductModel = new MultipleProductModel();
List<Category> categories = new List<Category>();
string jsonUrl = $"/api/products/count";
object productsCount = nopApiClient.Get(jsonUrl);
var nopProductsCount = JsonConvert.DeserializeObject<ProductsCount>(productsCount.ToString());
int sinceID = 0;
do
{
jsonUrl = $"/api/products?limit=250&since_id=" + sinceID.ToString() + $"&fields=id,sku,name,images,categories";
object productsData = nopApiClient.Get(jsonUrl);
var productsRootObject = JsonConvert.DeserializeObject<ProductsRootObject>(productsData.ToString());
multipleProductModel.MProductsApi.AddRange(productsRootObject.Products);
var last = multipleProductModel.MProductsApi.LastOrDefault();
sinceID = Convert.ToInt16(last.Id);
} while (multipleProductModel.MProductsApi.Count < nopProductsCount);
public class ProductsCount
{
public int Count { get; set; }
}
Why won't it allow me to use nopProductsCount on the while line?
It gives this error:
error CS0019: Operator '<' cannot be applied to operands of type 'int' and 'ProductListViewComponent.ProductsCount'
Thanks,
Tony
Stop The World, I want To Get Off! ........... Life Isn't About Waiting For The Storm To Pass ... It's About Learning To Dance In The Rain.
Continue reading...