public async Task SaveUsernameAsync(UserToSend item) { var json = await Task.Run(() => JsonConvert.SerializeObject(item)); var content = await Task.Run(() => new StringContent("data=" + json, Encoding.UTF8, "application/json")); HttpResponseMessage response = null; response = await client.PostAsync("http://timekeeperapi.azurewebsites.net/api.php/table3", content); }
public void seAllUsers(string name, int userId) { foreach (User user in userList) { if (user.getUserID().Equals(userId)) { user.setName(name); } } UserToSend myUserToSend = new UserToSend(name, userId); setUsernameDatabase(myUserToSend); }
public async void setUsernameDatabase(UserToSend item) { RestService myService = new TimekeeperDisplayApp.RestService(); await myService.SaveUsernameAsync(item); }