public UserInformation RetrieveUserInformation(ApplicationUser applicationUser)
{
var userInformation = _dataContext.GetQueryable<ApplicationUser>()
.Where(user => user.Id == applicationUser.Id)
.Select(user => new UserInformation
{
UserId = user.Id,
Email = user.Email,
UserName = user.UserName,
GamingGroups = user.UserGamingGroups.Select(userGamingGroup => new GamingGroupInfoForUser
{
GamingGroupId = userGamingGroup.GamingGroup.Id,
GamingGroupName = userGamingGroup.GamingGroup.Name,
GamingGroupPublicDescription = userGamingGroup.GamingGroup.PublicDescription,
GamingGroupPublicUrl = userGamingGroup.GamingGroup.PublicGamingGroupWebsite
}).ToList(),
Players = user.Players.Select(player => new PlayerInfoForUser
{
PlayerId = player.Id,
PlayerName = player.Name,
GamingGroupId = player.GamingGroupId
}).ToList(),
BoardGameGeekUser = user.BoardGameGeekUser != null ? new BoardGameGeekUserInformation
{
Name = user.BoardGameGeekUser.Name,
Avatar = user.BoardGameGeekUser.Avatar
} : null
}).First();
return userInformation;
}
}