Beispiel #1
0
 public List <LeadDto> GetLeadsByPage(GetLeadsByPageDto dto)
 {
     return(ctx.Leads.
            Skip((dto.PageNo - 1) * AdminSettings.Block).
            Take(AdminSettings.Block).
            Where(p => dto.UserId == null || p.UserId == dto.UserId).
            Include(p => p.StoreImages).ThenInclude(p => p.Document).
            Include(p => p.StoreCategories).ThenInclude(p => p.StoreCategory).
            Include(p => p.User).
            Select(p => DtoBuilder.CreateLeadDto(p)).
            ToList());
 }
Beispiel #2
0
        public GetLeadsByPageResultDto Execute(GetLeadsByPageDto dto)
        {
            GetLeadsByPageResultDto result = new GetLeadsByPageResultDto {
                Status = true, Page = new PageDto {
                    PageNo = dto.PageNo
                }
            };
            List <LeadDto> lst = unit.Lead.GetLeadsByPage(dto);

            result.Object            = lst;
            result.Page.Total        = unit.Lead.GetLeadsByPageCount(dto);
            result.Page.CurrentCount = lst.Count;
            return(result);
        }
Beispiel #3
0
 public ActionResult <GetLeadsByPageResultDto> GetLeadsByPage([FromQuery] GetLeadsByPageDto dto)
 {
     return(getLeadsByPage.Execute(dto));
 }
Beispiel #4
0
 public int GetLeadsByPageCount(GetLeadsByPageDto dto)
 {
     return(ctx.Leads.
            Where(p => dto.UserId == null || p.UserId == dto.UserId).
            Count());
 }