Exemplo n.º 1
0
        public List <Categories> GetCategoriesList_Api()
        {
            JArray result = _clientApiHelper.GetAsync("api/Categories");

            _categoryListApi = new List <Categories>();
            foreach (var item in result)
            {
                _categoryListApi.Add(new Categories()
                {
                    Id          = Convert.ToInt32(item["Id"]),
                    Description = item["Description"].ToString()
                });
            }
            return(_categoryListApi);
        }
        public List <Products> GetProductsList_Api()
        {
            JArray result = _clientApiHelper.GetAsync("api/Products");

            _productListApi = new List <Products>();
            foreach (var item in result)
            {
                _productListApi.Add(new Products()
                {
                    Id          = Convert.ToInt32(item["Id"]),
                    Name        = item["Name"].ToString(),
                    Price       = Convert.ToDecimal(item["Price"]),
                    Rank        = Convert.ToInt32(item["Rank"]),
                    Category_Id = Convert.ToInt32(item["Category_Id"])
                });
            }
            return(_productListApi);
        }