public static async Task<Response> EditUser(User.PutUser user) { try { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(URL.BASE); var newObject = JsonConvert.SerializeObject(user); HttpResponseMessage result = await client.PutAsync(URL.USER_EDIT, new StringContent(newObject, Encoding.UTF8, "application/json")); string json = await result.Content.ReadAsStringAsync(); Response data = JsonConvert.DeserializeObject<Response>(json); return data; } } catch (JsonException jex) { return new Response() { Error = "Parse Error: " + jex.ToString(), Success = false }; } catch (Exception ex) { return new Response() { Error = ex.Message.ToString(), Success = false }; } }
private void FriendRequest(User.All fromUser) { Messenger.Default.Send<Dialog>(new Dialog() { Message = fromUser.User.ToString() + " wilt u toevoegen als vriend", Ok = "Accept", Nok = "Ignore", Data = JsonConvert.SerializeObject(fromUser), ViewOk = typeof(ZoekVrienden), Cb = "friend_accepted", IsNotification = true }); }