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()); }
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); }
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()); }
public ActionResult <GetOrdersByPageResultDto> GetOrdersByPage([FromQuery] GetOrdersByPageDto dto) { return(getOrdersByPage.Execute(dto)); }