public void TestPlayerDTODeserialisation()
        {
            string     playerJSON = @" {
                ""players"": [
                    {
                        ""id"": 1,
                        ""score"": 10,
                        ""health"": 5,
                        ""location"": {
                            ""x"": 2,
                            ""y"": 2
                        },
                        ""orientation"": ""East""
                    },
                    {
                        ""id"": 1,
                        ""score"": 11,
                        ""health"": 8,
                        ""location"": {
                            ""x"": 2,
                            ""y"": 1
                        },
                        ""orientation"": ""South""
                    }
                ]
            }";
            PlayersDTO playersDTO = JsonUtility.FromJson <PlayersDTO>(playerJSON);

            Assert.AreEqual(2, playersDTO.players.Length);
            PlayerDTO player = playersDTO.players[0];

            Assert.IsNotNull(player);
            Assert.AreEqual(1, player.id);
            Assert.AreEqual(10, player.score);
            Assert.AreEqual(5, player.health);
            Assert.AreEqual(new Location(2, 2), player.location);
            Assert.AreEqual(Orientation.East, player.orientationType);
        }
Esempio n. 2
0
        public PlayerDTO  GetScoresbyUserId(string userId)
        {
            PlayerDTO playerDto   = new  PlayerDTO();
            var       ps          = db.PlayerScores.Where(e => e.EmpId == userId).FirstOrDefault();
            var       userDetails = db.Users.Where(e => e.EmpID == userId).FirstOrDefault();

            if (ps != null)
            {
                playerDto = new PlayerDTO()
                {
                    EmpId              = (userDetails != null) ? userDetails.EmpID.ToString() : string.Empty,
                    Location           = (ps.Location != null) ? ps.Location.Name : string.Empty,
                    PlayerName         = (userDetails != null) ? userDetails.FirstName + " " + userDetails.LastName : string.Empty,
                    Quiz1Score         = ps.Quiz1Score.ToString(),
                    Quiz2Score         = ps.Quiz2Score.ToString(),
                    Quiz3Score         = ps.Quiz3Score.ToString(),
                    Quiz4Score         = ps.Quiz4Score.ToString(),
                    CommulativeScore   = ps.CummulativeScore.GetValueOrDefault().ToString(),
                    LeadershipPosition = ps.LeadershipPosition.GetValueOrDefault().ToString()
                };
            }
            return(playerDto);
        }
Esempio n. 3
0
        public List <PlayerDTO> GetWinner(int gameId)
        {
            List <PlayerDTO> returnList = new List <PlayerDTO>();

            var players = gameEntities.Players.Where(a => a.GameId == gameId).ToList();

            foreach (var player in players)
            {
                PlayerDTO temp = new PlayerDTO();
                temp.PlayerId   = player.PlayerId;
                temp.PlayerName = player.PlayerName;

                var            bank       = gameEntities.BankAccounts.FirstOrDefault(x => x.PlayerId == player.PlayerId);
                var            transCount = gameEntities.Transcations.Where(a => a.AccountId == bank.AccountId).Count();
                BankAccountDTO bankAcc    = Mapping.Mapper.Map <BankAccountDTO>(bank);
                temp.BankAccount      = bankAcc;
                temp.NoOfTransactions = transCount;

                returnList.Add(temp);
            }

            return(returnList.OrderByDescending(a => a.BankAccount.Balance).ThenByDescending(x => x.NoOfTransactions).ToList());
        }
Esempio n. 4
0
        public async Task <IActionResult> OnGetAsync()
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'."));
            }

            var player = await _apiClient.GetPlayerAsync(user.UserName);


            Player = new PlayerDTO
            {
                Id       = player.Id,
                UserName = player.UserName,
                Age      = player.Age,
                Info     = player.Info
            };


            return(Page());
        }
        private PlayerDTO PlayerToDTO(PlayerModel playerModel)
        {
            var squadDTOs = new List <SquadDTO>();

            foreach (SquadModel squadModel in playerModel.Squads)
            {
                var squadDTO = new SquadDTO
                {
                    SquadId   = squadModel.SquadId,
                    Armaments = squadModel.Armaments,
                    Stats     = squadModel.Stats
                };
                squadDTOs.Add(squadDTO);
            }
            var playerDTO = new PlayerDTO
            {
                GameId   = playerModel.GameId,
                PlayerId = playerModel.PlayerId,
                Squads   = squadDTOs
            };

            return(playerDTO);
        }
        public async Task <ActionResult <PlayerResponse> > PostPlayerAsync(PlayerDTO input)
        {
            var existingPlayer = await _context.Players.Where(p => p.UserName == input.UserName).FirstOrDefaultAsync();

            if (existingPlayer != null)
            {
                return(Conflict(input));
            }

            var player = new Player
            {
                UserName = input.UserName,
                Age      = input.Age,
                Info     = input.Info
            };

            _context.Players.Add(player);
            await _context.SaveChangesAsync();

            var result = player.MapPlayerResponse();

            return(CreatedAtAction(nameof(GetPlayerAsync), new { username = player.UserName }, result));
        }
Esempio n. 7
0
        public void TestGeneratePlayerByDTO()
        {
            PlayerDTO  playerDTO      = new PlayerDTO();
            Location   playerLocation = new Location(10, 20);
            GameObject playersFolder  = GameObject.Find("Players");

            playerDTO.location = playerLocation;
            playerDTO.id       = 1;

            GameObject generatedPlayer = PlayerGenerator.GeneratePlayer(playerDTO, playersFolder);

            Assert.AreEqual(playerLocation.x, generatedPlayer.transform.localPosition.x);
            Assert.AreEqual(0, generatedPlayer.transform.localPosition.y);
            Assert.AreEqual(playerLocation.y, generatedPlayer.transform.localPosition.z);

            int      noOfSkins    = PlayerGenerator.numberOfSkins;
            Material expectedSkin = PlayerGenerator.materials[playerDTO.id % noOfSkins];
            Material returnedSkin = generatedPlayer.transform.Find("Dee").GetComponent <Renderer>().sharedMaterial;

            Assert.IsInstanceOf <Material>(returnedSkin);
            Assert.AreEqual(expectedSkin, returnedSkin);
            Assert.AreEqual(generatedPlayer.transform.parent.name, "Players");
        }
Esempio n. 8
0
        /// <summary>
        /// Deconstruct a PlayerDTO into a Player object
        /// </summary>
        /// <param name="playerDTO">PlayerDTO to be deconstructed</param>
        /// <returns>Player object from PlayerDTO</returns>
        public Player DeconstructDTO(PlayerDTO playerDTO)
        {
            Enum.TryParse(playerDTO.Race, out Race race);
            Enum.TryParse(playerDTO.Class, out Class playerClass);
            Enum.TryParse(playerDTO.ExperienceLevel, out ExperienceLevel exp);
            Player result = new Player
            {
                Id              = playerDTO.Id,
                UserId          = playerDTO.UserId,
                UserName        = playerDTO.UserName,
                UserEmail       = playerDTO.UserEmail,
                ImageUrl        = playerDTO.ImageUrl,
                CharacterName   = playerDTO.CharacterName,
                Class           = playerClass,
                Race            = race,
                ExperienceLevel = exp,
                GoodAlignment   = playerDTO.GoodAlignment,
                LawAlignment    = playerDTO.LawAlignment,
                PartyId         = playerDTO.PartyId,
            };

            return(result);
        }
Esempio n. 9
0
        /// <summary>
        /// Supports player addition into specific teams
        /// executes a loop and 1 to 1 process!
        /// </summary>
        /// <param name="teams"></param>
        /// <param name="match"></param>
        /// <param name="invites"></param>
        /// <returns></returns>
        async Task ShufflePlayersIntoTeams(List <TeamDTO> teams, MatchDTO match, List <InviteDTO> invites)
        {
            await Task.Run(() =>
            {
                PlayerDTO player    = null;
                bool AddedToTeamOne = false;
                foreach (var inv in invites)
                {
                    player = CreatePlayerFromInvite(inv);

                    if (!AddedToTeamOne)
                    {
                        AddedToTeamOne = true;
                        teams[0].Players.Add(player);
                        continue;
                    }

                    AddedToTeamOne = false;
                    teams[1].Players.Add(player);
                }
                match.Teams = teams;
            });
        }
Esempio n. 10
0
        // nba api
        public async Task <PlayerDTO> GetNbaPlayerStats(PlayerDTO player)
        {
            using (var http = new HttpClient())
            {
                var    uri  = new Uri(nbaStatsApiURL + player.NbaId + "_profile.json");
                string json = await http.GetStringAsync(uri);

                // do some bad magic string stuff, fix later if time left
                var statsJsonIncomplete = json.Split("teams")[1].Split("total")[0].Substring(3);
                var statsJson           = statsJsonIncomplete.Remove(statsJsonIncomplete.Length - 3);

                var playerStats = JsonConvert.DeserializeObject <PlayerStatsDTO>(statsJson);

                player.Ppg = playerStats.ppg;
                player.Rpg = playerStats.rpg;
                player.Apg = playerStats.apg;
                player.Bpg = playerStats.bpg;
                player.Spg = playerStats.spg;
                player.Fgp = playerStats.fgp;

                return(player);
            }
        }
Esempio n. 11
0
        public async Task <IActionResult> GetPlayers()
        {
            var players = _session.CreateCriteria <Player>().List <Player>();
            var results = new List <PlayerDTO>();

            foreach (var player in players)
            {
                var dto = new PlayerDTO
                {
                    DateOfBirth = player.DateOfBirth,
                    Id          = player.Id,
                    FirstName   = player.FirstName,
                    LastName    = player.LastName,
                    Team        = player.Team?.Name
                };
                results.Add(dto);
            }

            return(Ok(new
            {
                value = results
            }));
        }
        public async Task PostPlayerNoIdTest()
        {
            // Arrange
            var repo       = new FakePlayerRepository(TestData.Players());
            var controller = new PlayersController(repo, null);
            var player     = new PlayerDTO
            {
                LastName = "Doe", FirstName = "Jane", DateJoined = DateTime.Now
            };

            // Act
            var result = await controller.PostPlayer(player);

            // Assert
            Assert.IsNotNull(result);
            var objResult = result.Result as CreatedAtActionResult;

            Assert.IsNotNull(objResult);
            var retResult = objResult.Value as PlayerDTO;

            Assert.IsNotNull(retResult);
            Assert.AreEqual(player, retResult);
        }
        public async Task PutPlayerNoMatchIdTest()
        {
            // Arrange
            var repo       = new FakePlayerRepository(TestData.Players());
            var controller = new PlayersController(repo, NullLogger <PlayersController> .Instance);
            var playerId   = 1;
            var player     = new PlayerDTO
            {
                Id         = playerId + 1,
                DateJoined = DateTime.Now,
                FirstName  = "FIRSTNAME",
                LastName   = "LASTNAME"
            };

            // Act
            var result = await controller.PutPlayer(playerId, player);

            // Assert
            Assert.IsNotNull(result);
            var objResult = result as BadRequestResult;

            Assert.IsNotNull(objResult);
        }
        public async Task PutPlayerNotFoundTest()
        {
            // Arrange
            var repo       = new FakePlayerRepository(TestData.Players());
            var controller = new PlayersController(repo, null);
            var playerId   = 100;
            var player     = new PlayerDTO
            {
                Id         = playerId,
                DateJoined = DateTime.Now,
                FirstName  = "FIRSTNAME",
                LastName   = "LASTNAME"
            };

            // Act
            var result = await controller.PutPlayer(playerId, player);

            // Assert
            Assert.IsNotNull(result);
            var objResult = result as NotFoundResult;

            Assert.IsNotNull(objResult);
        }
        public void Feed([FromQuery] int id)
        {
            try
            {
                PlayerDTO pDTO = HttpContext.Session.GetObject <PlayerDTO>("player");
                if (pDTO != null)
                {
                    Player p = context.GetPlayerByID(pDTO.PlayerId);
                    Food   f = context.Foods.Where(n => n.FoodId == id).FirstOrDefault();
                    p.Pets.Where(p => p.StatusId != DEAD).FirstOrDefault().Feed(f, context);
                    Response.StatusCode = (int)System.Net.HttpStatusCode.OK;
                }

                else
                {
                    Response.StatusCode = (int)System.Net.HttpStatusCode.Forbidden;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Esempio n. 16
0
        public async Task CanUpdatePlayer()
        {
            var       repo         = BuildDb();
            PlayerDTO playerUpdate = new PlayerDTO()
            {
                Id              = 1,
                UserId          = "test1Update",
                CharacterName   = "Test1Name",
                Class           = "Druid",
                Race            = "Gnome",
                ExperienceLevel = "FirstTime",
                GoodAlignment   = 50,
                LawAlignment    = 50,
                PartyId         = 1
            };

            var update = await repo.UpdatePlayer(playerUpdate);

            Assert.NotNull(update);
            Assert.Equal(playerUpdate.Id, update.Id);
            Assert.Equal("test1Update", update.UserId);
            Assert.Equal(playerUpdate.Class, update.Class);
        }
        public List <PetStatsDTO> GetPets()
        {
            try
            {
                PlayerDTO p1 = HttpContext.Session.GetObject <PlayerDTO>("loggedin");

                if (p1 != null)
                {
                    Player             p    = this.context.Players.FirstOrDefault <Player>(p => p1.Email == p.Email);
                    List <PetStatsDTO> pets = p.Pets.Select(pet => new PetStatsDTO
                    {
                        Name      = pet.PetName,
                        Age       = pet.Age,
                        BirthDate = pet.BirthDate,
                        Happiness = pet.HappinessStatus,
                        Hunger    = pet.HungerStatus,
                        Hygiene   = pet.HygieneStatus,
                        Weight    = pet.PetWeight,
                        LifeCycle = pet.LifeCycleCodeNavigation.CycleName,
                        Health    = pet.HealthCodeNavigation.HealthName
                    }).ToList <PetStatsDTO>();

                    Response.StatusCode = (int)HttpStatusCode.OK;
                    return(pets);
                }
                else
                {
                    Response.StatusCode = (int)HttpStatusCode.Forbidden;
                    return(null);
                }
            }
            catch (Exception)
            {
                Response.StatusCode = (int)HttpStatusCode.Forbidden;
                return(null);
            }
        }
Esempio n. 18
0
        private async Task SavePenalties(IList <GamePagePenalty> penalties, IList <TeamDTO> teams, Guid gameId)
        {
            foreach (var penalty in penalties)
            {
                PlayerDTO player = null;
                if (!string.IsNullOrEmpty(penalty.Player))
                {
                    player = await GetOrCreatePlayer(penalty.Player);
                }
                var team = teams.First(t => t.ShortCode.ToUpper() == penalty.TeamShortCode.ToUpper());

                string penaltyType = penalty.PenaltyType;

                if (!string.IsNullOrWhiteSpace(penalty.PenaltyType))
                {
                    int charLocation = penalty.PenaltyType.IndexOf("(", StringComparison.Ordinal);

                    if (charLocation > 0)
                    {
                        penaltyType = penalty.PenaltyType.Substring(0, charLocation).Trim();
                    }
                }

                await _penaltyService.Upsert(new PenaltyDTO
                {
                    GameId = gameId,
                    Length = penalty.Length,
                    Time   = penalty.Time ?? TimeSpan.FromSeconds(0),
                    Period = penalty.Period,
                    PowerPlaySuccessful = false,
                    PlayerId            = player?.Id,
                    TeamId      = team.Id,
                    PenaltyType = GetPenaltyType(penaltyType),
                    CreatedOn   = DateTime.Now
                });
            }
        }
        public bool SignUp([FromBody] PlayerDTO player)
        {
            PlayerDTO pDTO = HttpContext.Session.GetObject <PlayerDTO>("player");

            if (pDTO == null)
            {
                Player p = new Player()
                {
                    PlayerId     = player.PlayerId,
                    FirstName    = player.FirstName,
                    LastName     = player.LastName,
                    Email        = player.Email,
                    Gender       = player.Gender,
                    Username     = player.Username,
                    PWord        = player.PWord,
                    DateOfBirth  = player.DateOfBirth,
                    ActiveAnimal = player.ActiveAnimal
                };
                try
                {
                    context.AddPlayer(p);
                }
                catch (Exception)
                {
                    Response.StatusCode = (int)System.Net.HttpStatusCode.Conflict;
                    return(false);
                }

                Response.StatusCode = (int)System.Net.HttpStatusCode.OK;
                return(true);
            }
            else
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.Forbidden;
                return(false);
            }
        }
Esempio n. 20
0
        public void Update(PlayerDTO result)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                Team2.Visibility = Visibility.Collapsed;
                Team3.Visibility = Visibility.Collapsed;
                Team4.Visibility = Visibility.Collapsed;
                Team5.Visibility = Visibility.Collapsed;
                int i            = 0;
                foreach (var item in result.TeamsSummary)
                {
                    var team = (TeamDTO)item;
                    switch (i)
                    {
                    case 0: Team1.Header = team.Name;
                        break;

                    case 1: Team2.Header = team.Name;
                        Team2.Visibility = Visibility.Visible;
                        break;

                    case 2: Team3.Header = team.Name;
                        Team3.Visibility = Visibility.Visible;
                        break;

                    case 3: Team4.Header = team.Name;
                        Team4.Visibility = Visibility.Visible;
                        break;

                    case 4: Team5.Header = team.Name;
                        Team5.Visibility = Visibility.Visible;
                        break;
                    }
                    i++;
                }
            }));
        }
        /// <summary>
        /// Check the user
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public bool IsUserValid(PlayerDTO player)
        {
            bool isValid = false;

            player.Password = HashPassword(player.Password);
            var result = _playerRepository.GetAll().FirstOrDefault(x => (x.Email == player.Username || x.Username == player.Username) && x.Password == player.Password);

            if (result != null)
            {
                if (player.Username.Contains("@"))
                {
                    var players = _playerRepository.GetAll().FirstOrDefault(x => x.Email == player.Username);
                    player.Email    = players.Email;
                    player.Username = players.Username;
                }

                FormsAuthentication.SetAuthCookie(result.Username + "|" + result.Id, player.RememberMe);
                return(isValid = true);
            }
            else
            {
                return(isValid);
            }
        }
        public async void ReturnPlayerWhoExistsInDbByGivenId()
        {
            // Assert
            var player = new Player()
            {
                Id          = 1,
                Name        = "Lionel",
                Surname     = "Messi",
                Height      = 169,
                Weight      = 68,
                Birthday    = new DateTime(1987, 6, 23),
                Nationality = "Argentina",
                DominantLeg = DominantLegType.Left,
                Nick        = "La Pulga",
                Number      = 10
            };

            PlayerDTO testPlayer = null;

            _repositoryMock.Reset();
            _repositoryMock.Setup(r => r.GetByIdAsync(It.IsAny <uint>())).ThrowsAsync(new ArgumentException());
            _repositoryMock.Setup(r => r.GetByIdAsync(1)).ReturnsAsync(player);

            var expectedPlayer = _mapper.Map <PlayerDTO>(player);

            // Act
            var err = await Record.ExceptionAsync(async
                                                      () => testPlayer = await _service.GetByIdAsync(1));

            // Arrange
            err.Should().BeNull();

            testPlayer.Should().NotBeNull();

            testPlayer.Should().BeEquivalentTo(expectedPlayer);
        }
Esempio n. 23
0
        public List <ActionsDTO> GetAllGames()
        {
            PlayerDTO pDto = HttpContext.Session.GetObject <PlayerDTO>("player");

            if (pDto != null)
            {
                List <TamaguchiBL.Models.Action> list = context.GetAllGames();
                List <ActionsDTO> listDTO             = new List <ActionsDTO>();
                if (list != null)
                {
                    foreach (TamaguchiBL.Models.Action a in list)
                    {
                        listDTO.Add(new ActionsDTO(a));
                    }
                }
                Response.StatusCode = (int)System.Net.HttpStatusCode.OK;
                return(listDTO);
            }
            else
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.Forbidden;
                return(null);
            }
        }
        public async Task RequestUpdate(PlayerRequest request)
        {
            if (request.PlayerId != ArmamentType.None)
            {
                PlayerDTO playerDTO = await _client.RequestPlayer(request.GameId, request.PlayerId);

                PlayerModel playerModel = PlayerToModel(playerDTO);

                _dataReceived.OnNext(playerModel);
            }
            else
            {
                var playerDTOs = await _client.RequestPlayerList(request.GameId);

                var playerModels = new List <PlayerModel>();
                foreach (PlayerDTO playerDTO in playerDTOs)
                {
                    PlayerModel playerModel = PlayerToModel(playerDTO);
                    playerModel.GameId = request.GameId;
                    playerModels.Add(playerModel);
                }
                _dataListReceived.OnNext(playerModels);
            }
        }
        private PlayerModel PlayerToModel(PlayerDTO playerDTO)
        {
            var squadModels = new List <SquadModel>();

            foreach (SquadDTO squadDTO in playerDTO.Squads)
            {
                var squadModel = new SquadModel
                {
                    PlayerId  = playerDTO.PlayerId,
                    SquadId   = squadDTO.SquadId,
                    Armaments = squadDTO.Armaments,
                    Stats     = squadDTO.Stats
                };
                squadModels.Add(squadModel);
            }

            var playerModel = new PlayerModel
            {
                PlayerId = playerDTO.PlayerId,
                Squads   = squadModels
            };

            return(playerModel);
        }
Esempio n. 26
0
        private void Play()
        {
            MoveResult result;

            _gameController.Start();
            do
            {
                Console.Clear();
                PlayerDTO currentPlayer = _gameController.GetCurrentPlayer();
                Console.WriteLine($"Player {currentPlayer.Name} with color {currentPlayer.Color}.");
                Console.Write("Press Enter to play ");
                while (Console.ReadKey(true).Key != ConsoleKey.Enter)
                {
                    ;
                }
                result = _gameController.PlayeTurn();
                ShowResult(result);
                Console.Write("Press Enter to continue...");
                while (Console.ReadKey(true).Key != ConsoleKey.Enter)
                {
                    ;
                }
            } while (!result.IsWinner);
        }
Esempio n. 27
0
        public async Task <bool> RegisterAsync(PlayerDTO player)
        {
            string url = this.baseUrl + "/Register";

            try
            {
                string              json          = JsonSerializer.Serialize(player);
                StringContent       stringContent = new StringContent(json, Encoding.UTF8, "application/json");
                HttpResponseMessage response      = await client.PostAsync(url, stringContent);

                if (response.IsSuccessStatusCode)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 28
0
        public void Load()
        {
            using (StreamWriter writer = new StreamWriter(selectedProfilePath))
            {
                switch (selectedProfile.name)
                {
                default:
                    break;

                case "Slot":
                    savePlayerDataPath += "1" + ".json";
                    saveItemPath       += "1" + ".json";
                    saveEquipmentPath  += "1" + ".json";
                    writer.Write("1");
                    break;

                case "Slot (1)":
                    savePlayerDataPath += "2" + ".json";
                    saveItemPath       += "2" + ".json";
                    saveEquipmentPath  += "2" + ".json";
                    writer.Write("2");
                    break;

                case "Slot (2)":
                    savePlayerDataPath += "3" + ".json";
                    saveItemPath       += "3" + ".json";
                    saveEquipmentPath  += "3" + ".json";
                    writer.Write("3");
                    break;
                }
                string    json = File.ReadAllText(savePlayerDataPath);
                PlayerDTO dto  = JsonConvert.DeserializeObject <PlayerDTO>(json);
                DisableAllBtn();
                SceneManager.LoadScene(dto.SceneIndex);
            }
        }
Esempio n. 29
0
        public async Task CanDeletePlayer()
        {
            PlayerDTO newPlayer = new PlayerDTO()
            {
                UserId          = "test1",
                CharacterName   = "Test1Name",
                Class           = "Barbarian",
                Race            = "Dragonborn",
                ExperienceLevel = "FirstTime",
                GoodAlignment   = 50,
                LawAlignment    = 50,
                PartyId         = 1
            };
            var repo   = BuildDb();
            var create = await repo.CreatePlayer(newPlayer);

            Assert.NotNull(create);

            await repo.DeletePlayer(create.Id);

            var result = await repo.GetPlayerByUserId("test1");

            Assert.Null(result);
        }
Esempio n. 30
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                PlayerDTO player = new PlayerDTO()
                {
                    Email    = model.Email,
                    Password = model.Password,
                    Name     = model.Name,
                    Surname  = model.Surname
                };
                var result = await playerService.Create(player);

                if (!result.Succedeed)
                {
                    ModelState.AddModelError(result.Property, result.Message);
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(View(model));
        }