Beispiel #1
0
        // #region Fields

        #region Methods

        // GET: /History/
        public async Task <IActionResult> Index()
        {
            //var historyItems = new List<HistoryModel>();

            // if (Session.GetString(_cartItesmSessionKey) != null)
            //     cartItems = JsonConvert.DeserializeObject<List<CartItemModel>>(Session.GetString(_cartItesmSessionKey));
            // historyItems.Add(new HistoryModel(){
            //     Id = 1,
            //     Name = "Laptop",
            //     Price = 25000,
            //     Quantity = 1,
            //     ProductImage = "/Images/asus gtx 1070 strix.png",
            //     Action = "Buy",
            //     DateofPurchase = new DateTime(2020,1,24,0,0,0)
            // });
            // return View(historyItems);
            var historyList = new List <HistoryModel>();

            var productServiceClient = new ProductServiceClient();

            IAsyncEnumerator <HistoryModel> products = productServiceClient.GetHistory();

            while (await products.MoveNextAsync())
            {
                historyList.Add(products.Current);
            }
            await products.DisposeAsync();

            return(View(historyList));
        }