Пример #1
0
 public int GetOrdersByPageCount(GetOrdersByPageDto dto)
 {
     return(ctx.Orders.
            Include(p => p.Party).ThenInclude(p => p.User).
            Where(p =>
                  (dto.UserId == null || p.Party.UserId == dto.UserId) &&
                  (dto.PartyId == null || p.PartyId == dto.PartyId)).
            Count());
 }
Пример #2
0
        public GetOrdersByPageResultDto Execute(GetOrdersByPageDto dto)
        {
            GetOrdersByPageResultDto result = new GetOrdersByPageResultDto {
                Status = true, Page = new PageDto {
                    PageNo = dto.PageNo
                }
            };
            List <OrderDto> lst = unit.Order.GetOrdersByPage(dto);

            result.Object            = lst;
            result.Page.Total        = unit.Order.GetOrdersByPageCount(dto);
            result.Page.CurrentCount = lst.Count;
            return(result);
        }
Пример #3
0
 public List <OrderDto> GetOrdersByPage(GetOrdersByPageDto dto)
 {
     return(ctx.Orders.
            Skip((dto.PageNo - 1) * AdminSettings.Block).
            Take(AdminSettings.Block).
            Include(p => p.Party).ThenInclude(p => p.User).
            Where(p =>
                  (dto.UserId == null || p.Party.UserId == dto.UserId) &&
                  (dto.PartyId == null || p.PartyId == dto.PartyId)).
            Include(p => p.Party).ThenInclude(p => p.StoreCategories).ThenInclude(p => p.StoreCategory).
            Include(p => p.Party).ThenInclude(p => p.StoreImages).ThenInclude(p => p.Document).
            Include(p => p.InvoiceImages).ThenInclude(p => p.Document).
            Select(p => DtoBuilder.CreateOrderDto(p)).
            ToList());
 }
Пример #4
0
 public ActionResult <GetOrdersByPageResultDto> GetOrdersByPage([FromQuery] GetOrdersByPageDto dto)
 {
     return(getOrdersByPage.Execute(dto));
 }