public async Task <bool> SaveTrainingSession(TrainingSessionRequest session) { if (Connectivity.NetworkAccess == NetworkAccess.None) { return(false); } var saveRequestUrl = $"{Constants.WebServerBaseUrl}{saveRequestBase}"; try { // get the user name - "Matt" will be seed data if nothing else var userName = Preferences.Get(Constants.UserIdPreference, "Matt"); // perform the request var request = new HttpRequestMessage(HttpMethod.Post, saveRequestUrl); request.Content = new StringContent(JsonConvert.SerializeObject(session), Encoding.UTF8, "application/json"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); return(true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); return(false); } }
public async Task <bool> SaveTrainingSession(TrainingSessionRequest session) { try { var saveRequestUrl = $"{Constants.WebServerBaseUrl}{saveRequestBase}"; // perform the request var request = new HttpRequestMessage(HttpMethod.Post, saveRequestUrl); request.Content = new StringContent(JsonConvert.SerializeObject(session), Encoding.UTF8, "application/json"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); return(true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); return(false); } }
public async Task <bool> SaveTrainingSession(TrainingSessionRequest session) { return(await Task.FromResult(true)); }