public async Task <IActionResult> OnGetAsync() { var user = await _userManager.GetUserAsync(User); CurrentUser = user ?? throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); ExtendedUser = await ExtendedUserRepository.GetExtendedUser(user.Id); PrivateTracksLeft = ExtendedUser.Private_Tracks_Max - ExtendedUser.Private_Tracks; return(Page()); }
public async Task <IActionResult> OnGetAsync() { var user = await _userManager.GetUserAsync(User); _currentUser = user ?? throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'."); _tracks = await TrackRepository.GetTracksByOwnerId(user.Id); foreach (var track in _tracks) { track.track_key = AuthRepository.EncodeKeyAndSecret(track.track_key, track.track_secret); } _extendedUser = await ExtendedUserRepository.GetExtendedUser(user.Id); if (_extendedUser == null) { _extendedUser = await ExtendedUserRepository.CreateExtendedUser(new ExtendedUser(user.Id)); } return(Page()); }