public IActionResult All(SearchWorkoutInputModel inputModel, int id = 1)
        {
            if (id <= 0)
            {
                return(this.NotFound());
            }

            var result = this.workoutsService.GetSearchedPositions <WorkoutInListViewModel>(inputModel, id, ItemsPerPage);

            var viewModel = new ListOfWorkoutsViewModel
            {
                ItemsPerPage  = ItemsPerPage,
                PageNumber    = id,
                WorkoutsCount = result.Count,
                Workouts      = result.Workouts,
                PointGuard    = inputModel.PointGuard,
                ShootingGuard = inputModel.ShootingGuard,
                SmallForward  = inputModel.SmallForward,
                PowerForward  = inputModel.PowerForward,
                Center        = inputModel.Center,
            };

            return(this.View(viewModel));
        }
        public void GetAllShouldReturnChosenWorkoutWhenFilteredForIt()
        {
            var workouts = new List <Workout>
            {
                new Workout
                {
                    Id          = "workoutId123",
                    Name        = "Workout One",
                    Description = "Some kind of workout description",
                    Position    = new Position
                    {
                        Id          = "PositionOne",
                        Name        = PositionName.ShootingGuard,
                        Description = "Shooting guard position",
                        Playstyle   = "You play like a shooting guard",
                    },
                    VideoUrl   = "test youtube link",
                    PositionId = "PositionOne",
                    Picture    = new Picture {
                        Id = "pic", Url = "test url"
                    },
                    PictureId    = "pic",
                    ImageUrl     = "testimg",
                    AddedByCoach = new Coach
                    {
                        Id          = "c1",
                        Name        = "Coach1",
                        Description = "desc1",
                        Experience  = 2,
                        Phone       = "321312312",
                        Email       = "*****@*****.**",
                        User        = new ApplicationUser {
                            Id = "coachuser"
                        },
                        UserId  = "coachuser",
                        Picture = new Picture {
                            Id = "cpic", Url = "test xurl"
                        },
                        PictureId = "cpic",
                    },
                },
                new Workout
                {
                    Id          = "workoutId456",
                    Name        = "Workout Two",
                    Description = "Some kind of random description",
                    Position    = new Position
                    {
                        Id          = "PositionTwo",
                        Name        = PositionName.PointGuard,
                        Description = "Point guard position",
                        Playstyle   = "You play like a point guard",
                    },
                    PositionId = "PositionTwo",
                    VideoUrl   = "test youtube link 2",
                    Picture    = new Picture {
                        Id = "2pic", Url = "test 2url"
                    },
                    PictureId    = "2pic",
                    ImageUrl     = "2testimg",
                    AddedByCoach = new Coach
                    {
                        Id          = "c2",
                        Name        = "Coach2",
                        Description = "desc2",
                        Experience  = 8,
                        Phone       = "322312312",
                        Email       = "*****@*****.**",
                        User        = new ApplicationUser {
                            Id = "coachuser2"
                        },
                        UserId  = "coachuser2",
                        Picture = new Picture {
                            Id = "cpic2", Url = "test xurl2"
                        },
                        PictureId = "cpic2",
                    },
                },
                new Workout
                {
                    Id          = "workoutId789",
                    Name        = "Workout Three",
                    Description = "Some kind of random description again",
                    Position    = new Position
                    {
                        Id          = "PositionThree",
                        Name        = PositionName.Center,
                        Description = "Center position",
                        Playstyle   = "You play like a center",
                    },
                    PositionId = "PositionThree",
                    VideoUrl   = "test youtube link 3",
                    Picture    = new Picture {
                        Id = "3pic", Url = "test 3url"
                    },
                    PictureId    = "3pic",
                    ImageUrl     = "3testimg",
                    AddedByCoach = new Coach
                    {
                        Id          = "c3",
                        Name        = "Coach3",
                        Description = "desc3",
                        Experience  = 5,
                        Phone       = "32235412",
                        Email       = "*****@*****.**",
                        User        = new ApplicationUser {
                            Id = "coachuser3"
                        },
                        UserId  = "coachuser3",
                        Picture = new Picture {
                            Id = "cpic3", Url = "test xurl3"
                        },
                        PictureId = "cpic3",
                    },
                },
                new Workout
                {
                    Id          = "workoutId21312312",
                    Name        = "Workout Four",
                    Description = "Some kind of random description agaixn",
                    Position    = new Position
                    {
                        Id          = "PositionFour",
                        Name        = PositionName.SmallForward,
                        Description = "Small Forward position",
                        Playstyle   = "You play like a SF",
                    },
                    PositionId = "PositionFour",
                    VideoUrl   = "test youtube link 4",
                    Picture    = new Picture {
                        Id = "4pic", Url = "test 4url"
                    },
                    PictureId    = "4pic",
                    ImageUrl     = "4testimg",
                    AddedByCoach = new Coach
                    {
                        Id          = "c4",
                        Name        = "Coach4",
                        Description = "desc4",
                        Experience  = 6,
                        Phone       = "32235212",
                        Email       = "*****@*****.**",
                        User        = new ApplicationUser {
                            Id = "coachuser4"
                        },
                        UserId  = "coachuser4",
                        Picture = new Picture {
                            Id = "cpic4", Url = "test xurl4"
                        },
                        PictureId = "cpic4",
                    },
                },
                new Workout
                {
                    Id          = "workoutId2312312312312",
                    Name        = "Workout Five",
                    Description = "Some kind of randommm description again",
                    Position    = new Position
                    {
                        Id          = "PositionFive",
                        Name        = PositionName.PowerForward,
                        Description = "Power Forward position",
                        Playstyle   = "You play like a PF",
                    },
                    PositionId = "PositionFive",
                    VideoUrl   = "test youtube link 5",
                    Picture    = new Picture {
                        Id = "5pic", Url = "test 5url"
                    },
                    PictureId    = "5pic",
                    ImageUrl     = "5testimg",
                    AddedByCoach = new Coach
                    {
                        Id          = "c5",
                        Name        = "Coach5",
                        Description = "desc5",
                        Experience  = 9,
                        Phone       = "34435212",
                        Email       = "*****@*****.**",
                        User        = new ApplicationUser {
                            Id = "coachuser5"
                        },
                        UserId  = "coachuser5",
                        Picture = new Picture {
                            Id = "cpic5", Url = "test xurl5"
                        },
                        PictureId = "cpic5",
                    },
                },
            };

            var positionsService = new PositionsService(this.positionsRepository.Object);
            var coachesService   = new CoachesService(this.coachRepository.Object, this.moqCloudinaryService.Object);

            this.workoutsRepository.Setup(r => r.AllAsNoTracking()).Returns(() => workouts.AsQueryable());
            var service = new WorkoutsService(this.moqCloudinaryService.Object, this.workoutsRepository.Object, positionsService, coachesService);

            var inputModel = new SearchWorkoutInputModel
            {
                PointGuard    = true,
                ShootingGuard = false,
                SmallForward  = false,
                PowerForward  = false,
                Center        = false,
            };

            var workoutsAll = service.GetSearchedPositions <WorkoutInListViewModel>(inputModel, 1, 12);

            Assert.Equal("Workout Two", workoutsAll.Workouts.First().Name);
            Assert.Single(workoutsAll.Workouts);
            this.workoutsRepository.Verify(x => x.AllAsNoTracking(), Times.Once);
        }