Beispiel #1
0
        public async Task <IActionResult> AllOrders()
        {
            ViewBag.ActionTitle = "All Orders";
            var orders = await _orderRepository.GetAllOrdersAsync();

            var listOrdersVM = new ListOrdersWithId
            {
                Orders = new List <OrderWithId>()
            };

            foreach (var item in orders)
            {
                var newOrder = new OrderWithId
                {
                    MyOrderViewModel = item,
                    Id = item.Id
                };
                listOrdersVM.Orders.Add(newOrder);
            }
            return(View(listOrdersVM));
        }
Beispiel #2
0
        public async Task <IActionResult> MyOrder()
        {
            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var orders = await _orderRepository.GetAllOrdersAsync(userId);

            var listOrdersVM = new ListOrdersWithId
            {
                Orders = new List <OrderWithId>()
            };

            foreach (var item in orders)
            {
                var newOrder = new OrderWithId
                {
                    MyOrderViewModel = item,
                    Id = item.Id
                };
                listOrdersVM.Orders.Add(newOrder);
            }
            return(View(listOrdersVM));
        }