public IQueryResult <LearningPath> GetAllPaginated(string filter, RequestAllOptionsDTO optionsDTO) { var result = _collection.AsQueryable(); if (!string.IsNullOrEmpty(filter)) { result = result.Where(x => x.Name.ToLower().Contains(filter.ToLower())); } return(AutoMapperQueryble.Paginate(result, optionsDTO)); }
public static PaginationOptions <TDocument> AdaptOptionsToMongo <TDocument>(RequestAllOptionsDTO request) { if (request == null) { return(null); } return(new PaginationOptions <TDocument>() { Page = request.Page, PageSize = request.PageSize, Sorting = TransformToLambdas <TDocument>(request.Order) }); }
public IQueryResult <UserDTO> GetAllUsers(string filter, RequestAllOptionsDTO options) { var result = _collection.AsQueryable(); if (!string.IsNullOrEmpty(filter)) { result = result.Where(x => x.Name.ToLower().Contains(filter.ToLower())); } var mapped = _mapper.Map <IEnumerable <UserDTO> >(result); return(AutoMapperQueryble.Paginate(mapped, options)); }
public async Task <IQueryResult <CourseDTO> > GetAllCourses([FromQuery] string filter, [FromQuery] RequestAllOptionsDTO optionsDTO) { var result = await _courseRepository.GetAllPaginatedCourses(filter, optionsDTO); return(result); }
public static Task <IQueryResult <TDocument> > Paginate <TDocument>(this IMongoQueryable <TDocument> queryable, RequestAllOptionsDTO options) { return(queryable.Paginate(TotvsApiMongoAdapter.AdaptOptionsToMongo <TDocument>(options))); }
public IQueryResult <UserDTO> GetAllUsers([FromQuery] string filter, [FromQuery] RequestAllOptionsDTO options) { return(_repository.GetAllUsers(filter, options)); }
public static IQueryResult <TDocument> Paginate <TDocument>(IEnumerable <TDocument> documents, RequestAllOptionsDTO options) { return(Paginate(documents, TotvsApiMongoAdapter.AdaptOptionsToMongo <TDocument>(options))); }
public IQueryResult <LearningPath> GetAll([FromQuery] string filter, [FromQuery] RequestAllOptionsDTO optionsDTO) { var result = _repository.GetAllPaginated(filter, optionsDTO); return(result); }
public async Task <IQueryResult <CourseDTO> > GetAllPaginatedCourses(string filter, RequestAllOptionsDTO optionsDTO) { var result = _collection.AsQueryable(). Select(x => new CourseDTO() { Id = x.Id, Title = x.Title }); if (!string.IsNullOrEmpty(filter)) { result = result.Where(x => x.Title.ToLower().Contains(filter.ToLower())); } var paginated = await result.Paginate(optionsDTO); return(paginated); //_notificationContext.AddNotification("NO_COURSE_FOUND.", "No course was found with this filters.", EStatusCodeNotification.NotFound); //return null; }