示例#1
0
 static async Task<Morceau> GetNextMorceauAsync(string id)
 { 
     Morceau morceau = null;
     HttpResponseMessage response = await client.GetAsync($"api/next-morceau/{id}");
     if (response.IsSuccessStatusCode)
     {
         morceau = await response.Content.ReadAsAsync<Morceau>();
     }
     return morceau;
 }
示例#2
0
        static async Task<Morceau> CreateMorceauAsync(Morceau morceau)
        {
            HttpResponseMessage response = await client.PostAsJsonAsync(
                "api/morceau", morceau);
            response.EnsureSuccessStatusCode();

            morceau = await response.Content.ReadAsAsync<Morceau>();

            // return URI of the created resource.
            return morceau;
        }