예제 #1
0
 public LeadDto GetLeadById(GetLeadByIdDto dto)
 {
     return(ctx.Leads.
            Where(p => p.Id == dto.Id.ToGuid()).
            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)).
            FirstOrDefault());
 }
예제 #2
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());
 }