public async Task <bool> AddNewEntryToSaveGameAsync(UsingChallenge usingChallenge) { string json = await Task.Run(() => JsonConvert.SerializeObject(usingChallenge)); HttpContent content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage result = await _httpClient.PostAsync(new Uri(gameProfilesBaseUri, "GameProfiles/SaveGameEntry"), content); return(result.IsSuccessStatusCode); }
/// <summary>Updates the save game.</summary> /// <param name="currentChallenge">The current challenge.</param> private void UpdateSaveGame(ChallengeBase currentChallenge) { var newEntry = new UsingChallenge { ChallengeID = currentChallenge.ChallengeID, UsingID = GamePage.GameProfile.SaveGameID }; GamePage.GameProfile.SaveGame.Challenges.Add(newEntry); ViewModel.UpdateSaveGame.Execute(newEntry); }