public Task <CursorPagedList <TEntity, TEntityKey> > SearchAsync(IQueryable <TEntity> query, RSearchParams searchParams) { query = AddIncludes(query); query = AddWhereClauses(query, searchParams); return(CursorPagedList <TEntity, TEntityKey> .CreateAsync(query, searchParams, ConvertIdToBase64, ConvertBase64ToIdType, AddAfterExp, AddBeforeExp)); }
public Task <CursorPagedList <WorkoutCompletionRecord> > GetWorkoutCompletionRecordsForUserAsync(int userId, CompletionRecordSearchParams searchParams) { IQueryable <WorkoutCompletionRecord> query = context.WorkoutCompletionRecords .Where(record => record.UserId == userId); return(CursorPagedList <WorkoutCompletionRecord> .CreateAsync(query, searchParams)); }
public Task <CursorPagedList <Expense, int> > GetExpensesForBudgetAsync(int budgetId, CursorPaginationParameters searchParams) { IQueryable <Expense> query = context.Expenses .Where(expense => expense.BudgetId == budgetId); return(CursorPagedList <Expense, int> .CreateAsync(query, searchParams)); }
public Task <CursorPagedList <TEntity> > SearchAsync(IQueryable <TEntity> query, RSearchParams searchParams) { query = AddIncludes(query); query = AddWhereClauses(query, searchParams); return(CursorPagedList <TEntity> .CreateAsync(query, searchParams)); }
public Task <CursorPagedList <ExerciseGroup> > GetScheduledWorkoutAdHocExercisesAsync(int scheduledWorkoutId, CursorPaginationParams searchParams) { IQueryable <ExerciseGroup> query = context.ExerciseGroups .Where(eg => eg.ScheduledWorkout.Id == scheduledWorkoutId) .Include(eg => eg.Exercise); return(CursorPagedList <ExerciseGroup> .CreateAsync(query, searchParams)); }
public Task <CursorPagedList <User> > GetScheduledWorkoutAttendeesAsync(int scheduledWorkoutId, CursorPaginationParams searchParams) { IQueryable <User> query = context.ScheduledWorkouts .Where(wo => wo.Id == scheduledWorkoutId) .SelectMany(swo => swo.Attendees.Select(attendee => attendee.User)); return(CursorPagedList <User> .CreateAsync(query, searchParams)); }
public Task <CursorPagedList <TEntity> > SearchDetailedAsync(RSearchParams searchParams) { IQueryable <TEntity> query = context.Set <TEntity>(); query = AddDetailedIncludes(query); query = AddWhereClauses(query, searchParams); return(CursorPagedList <TEntity> .CreateAsync(query, searchParams)); }
public Task <CursorPagedList <TEntity> > SearchAsync(RSearchParams searchParams, params Expression <Func <TEntity, object> >[] includes) { IQueryable <TEntity> query = context.Set <TEntity>(); query = AddIncludes(query); query = includes.Aggregate(query, (current, includeProperty) => current.Include(includeProperty)); query = AddWhereClauses(query, searchParams); return(CursorPagedList <TEntity> .CreateAsync(query, searchParams)); }
public CursorPaginatedResponse(CursorPagedList <T> items) { SetEdges(items); Nodes = items.ToList(); PageInfo = new PageInfo { StartCursor = items.StartCursor, EndCursor = items.EndCursor, HasNextPage = items.HasNextPage, HasPreviousPage = items.HasPreviousPage }; TotalCount = items.TotalCount; }
public Task <CursorPagedList <Role> > GetRolesAsync(CursorPaginationParams searchParams) { IQueryable <Role> query = context.Roles; return(CursorPagedList <Role> .CreateAsync(query, searchParams)); }
public static CursorPaginatedResponse <TSource, int> CreateFrom <TSource>(CursorPagedList <TSource, int> items, bool includeNodes = true, bool includeEdges = true) where TSource : class, IIdentifiable <int> { return(new CursorPaginatedResponse <TSource, int>(items, items.StartCursor, items.EndCursor, items.HasNextPage, items.HasPreviousPage, items.TotalCount, Id => Convert.ToBase64String(BitConverter.GetBytes(Id)), includeNodes, includeEdges)); }
public static CursorPaginatedResponse <TDestination, int> CreateFrom <TSource, TDestination>(CursorPagedList <TSource, int> items, Func <IEnumerable <TSource>, IEnumerable <TDestination> > mappingFunction, CursorPaginationParameters searchParams) where TSource : class, IIdentifiable <int> where TDestination : class, IIdentifiable <int> { return(CursorPaginatedResponse <TDestination, int> .CreateFrom(items, mappingFunction, searchParams.IncludeNodes, searchParams.IncludeEdges)); }
public static CursorPaginatedResponse <TDestination, int> CreateFrom <TSource, TDestination>(CursorPagedList <TSource, int> items, Func <IEnumerable <TSource>, IEnumerable <TDestination> > mappingFunction, bool includeNodes = true, bool includeEdges = true) where TSource : class, IIdentifiable <int> where TDestination : class, IIdentifiable <int> { var mappedItems = mappingFunction(items); return(new CursorPaginatedResponse <TDestination, int>(mappedItems, items.StartCursor, items.EndCursor, items.HasNextPage, items.HasPreviousPage, items.TotalCount, Id => Convert.ToBase64String(BitConverter.GetBytes(Id)), includeNodes, includeEdges)); }
public CursorPaginatedResponse(CursorPagedList <TEntity, TEntityKey> items, Func <TEntityKey, string> ConvertIdToBase64, bool includeNodes = true, bool includeEdges = true) : this(items, items.StartCursor, items.EndCursor, items.HasNextPage, items.HasPreviousPage, items.TotalCount, ConvertIdToBase64, includeNodes, includeEdges) { }
public static CursorPaginatedResponse <T> CreateFrom <TSource>(CursorPagedList <TSource> items, Func <IEnumerable <TSource>, IEnumerable <T> > mappingFunction) where TSource : class, IIdentifiable { var mappedItems = mappingFunction(items); return(new CursorPaginatedResponse <T>(mappedItems, items.StartCursor, items.EndCursor, items.HasNextPage, items.HasPreviousPage, items.TotalCount)); }