示例#1
0
        public override async Task <IPagedList <TOutput> > FilterAsync <TOutput>(StudentCurriculumFilterDto filter,
                                                                                 CancellationToken cancellationToken = default)
        {
            var query = BaseQuery.AsNoTracking().Where(x => x.Student.UserId == filter.UserId);

            if (!string.IsNullOrEmpty(filter.Q))
            {
                query = query.Where(x =>
                                    EF.Functions.ILike(x.Curriculum.Course.Title, $"%{filter.Q}%") ||
                                    EF.Functions.ILike(x.Curriculum.Teacher.FullName, $"%{filter.Q}%") ||
                                    EF.Functions.ILike(x.Curriculum.Field.Title, $"%{filter.Q}%"));
            }

            if (filter.Status.HasValue)
            {
                query = query.Where(x => x.Status == (StudentCurriculumStatus)filter.Status.Value);
            }

            if (filter.SemesterId.HasValue)
            {
                query = query.Where(x => x.Curriculum.Semester.Id == filter.SemesterId.Value);
            }

            return(await query.MapTo <TOutput>().SortBy(filter)
                   .ToPagedListAsync(filter.Count, filter.Page, cancellationToken));
        }
        public override async Task <IPagedList <TOutput> > FilterAsync <TOutput>(FilterBase filter,
                                                                                 CancellationToken cancellationToken = default)
        {
            var query = BaseQuery.AsNoTracking();

            return(await query.MapTo <TOutput>().SortBy(filter)
                   .ToPagedListAsync(filter.Count, filter.Page, cancellationToken));
        }
        public override async Task <IPagedList <TOutput> > FilterAsync <TOutput>(FilterBase filter, CancellationToken cancellationToken = default)
        {
            var query = BaseQuery.AsNoTracking();

            if (!string.IsNullOrEmpty(filter.Q))
            {
                query = query.Where(x => x.Title.Contains(filter.Q));
            }

            return(await query.MapTo <TOutput>().SortBy(filter).ToPagedListAsync(filter.Count, filter.Page, cancellationToken));
        }
示例#4
0
    public override async Task <IPagedList <TOutput> > FilterAsync <TOutput>(FilterBase filter, CancellationToken cancellationToken = default)
    {
        var query = BaseQuery.AsNoTracking();

        if (!string.IsNullOrEmpty(filter.Q))
        {
            query = query.Where(x =>
                                EF.Functions.Like(x.UserName, $"%{filter.Q}%") ||
                                EF.Functions.Like(x.Email, $"%{filter.Q}%")
                                );
        }


        return(await query.MapTo <TOutput>().SortBy(filter).ToPagedListAsync(filter.Count, filter.Page, cancellationToken));
    }
示例#5
0
        public override async Task <IPagedList <TOutput> > FilterAsync <TOutput>(CurriculumFilterDto filter,
                                                                                 CancellationToken cancellationToken = default)
        {
            var query = BaseQuery.AsNoTracking()
                        .Where(x => x.SemesterId == filter.SemesterId && x.FieldId == filter.FieldId);

            if (!string.IsNullOrEmpty(filter.Q))
            {
                query = query.Include(x => x.Course).Include(x => x.Field)
                        .Where(x =>
                               EF.Functions.ILike(x.Course.Title, $"%{filter.Q}%") ||
                               EF.Functions.ILike(x.Teacher.FullName, $"%{filter.Q}%") ||
                               EF.Functions.ILike(x.Field.Title, $"%{filter.Q}%"));
            }

            return(await query.MapTo <TOutput>().SortBy(filter)
                   .ToPagedListAsync(filter.Count, filter.Page, cancellationToken));
        }