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()); }
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()); }