Esempio n. 1
0
        public IEnumerable <Nouvelle> Donner(ObjetDonnerListe odl)
        {
            NouvelleService rs = new NouvelleService();

            return(rs.Donner(odl.ienum, odl.options).Select(j => j.VersAPI()));

            throw new NotImplementedException();
        }
        public IEnumerable <Nouvelle> Donner(ObjetDonnerListe e)
        {
            string              contenuJson = JsonConvert.SerializeObject(e, Formatting.Indented);
            StringContent       contenu     = new StringContent(contenuJson, Encoding.UTF8, "application/json");
            HttpResponseMessage reponse     = _client.PutAsync($"Nouvelle/Donner/", contenu).Result;

            if (!reponse.IsSuccessStatusCode)
            {
                throw new Exception("Echec de la réception de données.");
            }
            return(reponse.Content.ReadAsAsync <IEnumerable <Nouvelle> >().Result);

            throw new NotImplementedException();
        }