コード例 #1
0
        public async Task <IActionResult> Index(string buyerKey)
        {
            var spec = string.IsNullOrEmpty(buyerKey)
                ? BaseSpecification <Order> .Create(i => true)
                : BaseSpecification <Order> .Create(i => i.BuyerId.Contains(buyerKey));

            spec.AddInclude("OrderItems($select=UnitPrice,Units)");

            var orders = await orderRepository.ListAsync(spec);

            ViewBag.buyerKey = buyerKey;
            return(View(orders.OrderByDescending(i => i.OrderDate)));
        }