Exemple #1
0
        public async Task <ActionResult <CursorPaginatedResponse <ExerciseCategoryForReturnDto> > > GetExerciseCategoriesAsync([FromQuery] ExerciseCategorySearchParams searchParams)
        {
            var categories = await exerciseCategoryRepository.SearchAsync(searchParams);

            var paginatedResponse = CursorPaginatedResponse <ExerciseCategoryForReturnDto> .CreateFrom(categories, mapper.Map <IEnumerable <ExerciseCategoryForReturnDto> >);

            return(Ok(paginatedResponse));
        }
Exemple #2
0
        public async Task <ActionResult <CursorPaginatedResponse <ExerciseCategoryForReturnDto> > > GetExerciseCategoriesForExerciseAsync(int id, [FromQuery] CursorPaginationParams searchParams)
        {
            var categorySearchParams = new ExerciseCategorySearchParams
            {
                First        = searchParams.First,
                After        = searchParams.After,
                Last         = searchParams.Last,
                Before       = searchParams.Before,
                IncludeTotal = searchParams.IncludeTotal,
                ExerciseId   = new List <int> {
                    id
                }
            };

            var categories = await exerciseCategoryRepository.SearchAsync(categorySearchParams);

            var paginatedResponse = CursorPaginatedResponse <ExerciseCategoryForReturnDto> .CreateFrom(categories, mapper.Map <IEnumerable <ExerciseCategoryForReturnDto> >);

            return(Ok(paginatedResponse));
        }