Exemple #1
0
        public async Task <IEnumerable <OrderDto> > GetOrderAsync(int pageSize = 10, int pageNumber = 1, string name = null)
        {
            var model = await _orderDetailRepository
                        .AllIncludingAsync(m => m.MenuDetail, o => o.Order);

            return(model.GroupBy(o => new { Order = o.Order })
                   .Select(g => new OrderDetail
            {
                Order = g.Key.Order
            })
                   .OrderByDescending(a => a.OrderId)
                   .Skip(pageNumber - 1 * pageSize)
                   .Take(pageSize)
                   .Select(item => item.ToViewModel())
                   .ToList());
        }