コード例 #1
0
        public async Task addUitnodiging(string username, string wishlist)
        {
            HttpClient client        = new HttpClient();
            var        myContent     = JsonConvert.SerializeObject(username);
            var        stringContent = new StringContent(myContent, UnicodeEncoding.UTF8, "application/json");
            var        result        = await client.GetStringAsync(baseUrl + "/gebruiker/" + username);

            Gebruiker gebruiker = JsonConvert.DeserializeObject <Gebruiker>(result);

            gebruiker.addUitnodiging(wishlist);
            myContent     = JsonConvert.SerializeObject(gebruiker);
            stringContent = new StringContent(myContent, UnicodeEncoding.UTF8, "application/json");
            var rst = await client.PutAsync(baseUrl + "/gebruiker/" + gebruiker.name, stringContent);

            rst.EnsureSuccessStatusCode();
        }