public async Task <IActionResult> PartialViewPerGameMode(string gameMode, Match match, bool shack)
        {
            var user = await _userservice.getUserFromCp(HttpContext.User);

            var servers = await _matchService.FindAllMatchesWhereTheUserHasRights(HttpContext.User, user);

            if (match.Id != 0 && !servers.Select(x => x.Id).Contains(match.Id))
            {
                return(Forbid());
            }
            var selectedSteamIdentitiesRaw =
                (await _matchSelectedSteamIdentitiesService.FindAllSelectedForMatch(match.Id)).ToList();
            var selectedTeam0SteamIdentitiesRaw =
                (await _matchSelectedTeamSteamIdentitiesService.FindAllSelectedForMatchAndTeam(match.Id, 0)).ToList();
            var selectedTeam1SteamIdentitiesRaw =
                (await _matchSelectedTeamSteamIdentitiesService.FindAllSelectedForMatchAndTeam(match.Id, 1)).ToList();

            var Teams = (await _teamService.FindAll()).ToList();


            var steamIdentities = new List <SteamIdentity>();

            if (shack)
            {
                steamIdentities = (await _steamIdentityService.FindAll()).Where(x => !string.IsNullOrEmpty(x.OculusId)).ToList();
            }
            else
            {
                steamIdentities = (await _steamIdentityService.FindAll()).ToList();
            }
            var selectedSteamIdentities =
                (await _steamIdentityService.FindAList(selectedSteamIdentitiesRaw.Select(x => x.SteamIdentityId)
                                                       .ToList())).ToList();
            var selectedTeam0SteamIdentities =
                (await _steamIdentityService.FindAList(selectedTeam0SteamIdentitiesRaw.Select(x => x.SteamIdentityId)
                                                       .ToList())).ToList();
            var selectedTeam1SteamIdentities =
                (await _steamIdentityService.FindAList(selectedTeam1SteamIdentitiesRaw.Select(x => x.SteamIdentityId)
                                                       .ToList())).ToList();

            foreach (var selectedSteamIdentity in selectedSteamIdentities)
            {
                steamIdentities.Remove(steamIdentities.FirstOrDefault(x => x.Id == selectedSteamIdentity.Id));
            }
            var gotAnswer = GameModes.HasTeams.TryGetValue(gameMode, out var hasTeams);
            var idUsed    = "Id";

            if (shack)
            {
                idUsed = "OculusId";
            }
            if (gotAnswer)
            {
                if (hasTeams)
                {
                    var gotAnswer2 = GameModes.OneTeam.TryGetValue(gameMode, out var oneTeam);
                    if (gotAnswer2)
                    {
                        if (oneTeam)
                        {
                            return(PartialView("SteamIdentityPartialView", new SteamIdentityMatchViewModel
                            {
                                SelectedSteamIdentities = selectedSteamIdentities,
                                AllSteamIdentities = steamIdentities,
                                IdUsed = idUsed
                            }));
                        }
                        return(PartialView("TeamPartailView", new SteamIdentityMatchTeamViewModel
                        {
                            selectedTeam0 = match.Team0?.Id,
                            selectedTeam1 = match.Team1?.Id,
                            AvailableTeams = Teams,
                            SelectedSteamIdentitiesTeam0 = selectedTeam0SteamIdentities,
                            SelectedSteamIdentitiesTeam1 = selectedTeam1SteamIdentities,
                            IdUsed = idUsed
                        }));
                    }

                    BadRequest("internal error!");
                }
                else
                {
                    return(PartialView("SteamIdentityPartialView", new SteamIdentityMatchViewModel
                    {
                        SelectedSteamIdentities = selectedSteamIdentities,
                        AllSteamIdentities = steamIdentities
                    }));
                }
            }
            else
            {
                return(BadRequest("There is no gameMode like that!"));
            }

            return(BadRequest("There is no gameMode like that!"));
        }
        public void DefaultDB(bool teamMatch)
        {
            // arrange
            var pavlovServers =
                PavlovServerServiceTests.InitializePavlovServer(_sshServerSerivce, _pavlovServerService);

            pavlovServers.First().ServerType = ServerType.Event;
            _pavlovServerService.Upsert(pavlovServers.First());
            var tmpMatch = CreateMatch(_matchService, pavlovServers.First(), teamMatch, _teamService,
                                       _steamIdentityService, _userManager, _matchSelectedSteamIdentitiesService,
                                       _matchSelectedTeamSteamIdentitiesService);

            // act
            var result  = _matchService.FindOne(tmpMatch.Id).GetAwaiter().GetResult();
            var result2 = _matchService.FindAll().GetAwaiter().GetResult();

            result.Status = Status.Finshed;
            _matchService.Upsert(result).GetAwaiter().GetResult();

            if (teamMatch)
            {
                var matchTeamSelectedSteamIdentities =
                    _matchSelectedTeamSteamIdentitiesService.FindAll().GetAwaiter().GetResult();
                //cause i added 2
                matchTeamSelectedSteamIdentities.Should().HaveCount(2);

                var selected = _matchSelectedTeamSteamIdentitiesService.FindAllSelectedForMatchAndTeam(tmpMatch.Id,
                                                                                                       matchTeamSelectedSteamIdentities.First().TeamId).GetAwaiter().GetResult();
                //cause i selected one per team
                selected.Should().HaveCount(1);
                _matchSelectedTeamSteamIdentitiesService.RemoveFromMatch(matchTeamSelectedSteamIdentities.First().Id)
                .GetAwaiter().GetResult();

                matchTeamSelectedSteamIdentities =
                    _matchSelectedTeamSteamIdentitiesService.FindAll().GetAwaiter().GetResult();
                matchTeamSelectedSteamIdentities.Should().BeNullOrEmpty();
            }
            else
            {
                var matchSelectedSteamIdentities =
                    _matchSelectedSteamIdentitiesService.FindAll().GetAwaiter().GetResult();
                matchSelectedSteamIdentities.Should().HaveCount(2);


                matchSelectedSteamIdentities = _matchSelectedSteamIdentitiesService.FindAllSelectedForMatch(tmpMatch.Id)
                                               .GetAwaiter().GetResult();

                matchSelectedSteamIdentities.Should().HaveCount(2);


                _matchSelectedSteamIdentitiesService.RemoveFromMatch(tmpMatch.Id).GetAwaiter().GetResult();

                matchSelectedSteamIdentities = _matchSelectedSteamIdentitiesService.FindAll().GetAwaiter().GetResult();
                //cause i removed 1
                matchSelectedSteamIdentities.Should().BeNullOrEmpty();
            }


            var result3 = _matchService.CanBeDeleted(tmpMatch.Id).GetAwaiter().GetResult();
            var result4 = _matchService.Delete(tmpMatch.Id).GetAwaiter().GetResult();

            var result5 = _matchService.FindOne(tmpMatch.Id).GetAwaiter().GetResult();

            // assert
            result.Should().NotBeNull();
            result2.Should().HaveCount(1);
            result3.Should().BeTrue();
            result4.Should().BeTrue();
            result5.Should().BeNull();
        }