public ActionResult ProfilePage(int id = 0) { var player = _playerService.GetAllPlayers().FirstOrDefault(x => x.Id == id); var playerAward = _playerAwardService.GetAllPlayerAwards().Where(x => x.PlayerId == player.Id); var playerAwardName = _playerAwardService.GetPlayerAwardNames(player.Id); ProfilePageDTO profilePage = new ProfilePageDTO(); profilePage.playerDTOs = player; profilePage.playerAwardDTOs = playerAward; profilePage.playerAwardNamesDTOs = playerAwardName; return(View(profilePage)); }
public ActionResult ProfilePage(ProfilePageDTO profilePageDTO) { //var players = _playerService.GetAllPlayers().FirstOrDefault(x => x.Username == profilePageDTO.Username || x.Email == profilePageDTO.Email); PlayerDTO playerDTO = new PlayerDTO(); playerDTO.Id = profilePageDTO.Id; playerDTO.Email = profilePageDTO.Email; playerDTO.Username = profilePageDTO.Username; if (profilePageDTO.Password != null) { playerDTO.Password = profilePageDTO.Password; playerDTO.PasswordConfirm = profilePageDTO.PasswordConfirm; } _playerService.UpdatePlayer(playerDTO); return(RedirectToAction("LogOut", "User")); }