public Instrument (String nom,Photo photo, String description, String son) { this.nom = nom; this.photoInstrument = photo; this.description = description; this.son = son; }
public async Task setAsyncPhotoToBD() { String urlPhoto = "http://t8.ulule.me/vox/528/comment-hacker-photo-profil-facebook-1.jpeg"; var url = new Uri("http://webapiphone.azurewebsites.net/api/photos/RechercheIdMaxPhoto"); HttpClient client = new HttpClient(); var json = await client.GetStringAsync(url); List<int> idMaxPhoto = JsonConvert.DeserializeObject<List<int>>(json); idPhotoToAdd = idMaxPhoto[0] + 1; Photo photoToAdd = new Photo(idPhotoToAdd, urlPhoto); var urlString = new Uri("http://webapiphone.azurewebsites.net/api/photos/InsererPhoto"); client = new HttpClient(); await client.PostAsJsonAsync<Photo>(urlString, photoToAdd); }