public async Task AddQuestionToSavedProfile(Question newQuestion) { MaybeResult <PlayerProfile, GenericErrorResult> getProfileResult = await GetProfile(newQuestion.PlayerId); if (getProfileResult.IsError) { Debug.WriteLine($"Couldn't fine a profile with ID {newQuestion.PlayerId}"); return; } PlayerProfile profile = getProfileResult.Unwrap(); profile.Questions.Add(newQuestion); await SaveProfile(profile); _messagingService.Send(new ProfileUpdated { NewQuestion = newQuestion }); }
public async Task SelectProfile(Guid id) { MaybeResult <PlayerProfile, GenericErrorResult> profileSelectionResult = await _profileService.GetProfile(id); if (profileSelectionResult.IsError) { throw new ArgumentNullException("id", $"Unable to find a profile with the id {id} on the local device."); } // Navigate to profile overview page that shows all questions await _navigationService.NavigateToViewModelAsync <ProfileOverviewViewModel>(profileSelectionResult.Unwrap()); }