Ejemplo n.º 1
0
        public bool Bloquer(BlocageArbre e)
        {
            string              contenuJson = JsonConvert.SerializeObject(e, Formatting.Indented);
            StringContent       contenu     = new StringContent(contenuJson, Encoding.UTF8, "application/json");
            HttpResponseMessage reponse     = _client.PutAsync($"Arbre/Bloquer/", contenu).Result;

            if (!reponse.IsSuccessStatusCode)
            {
                throw new Exception("Echec de la réception de données.");
            }
            var x = reponse.Content.ReadAsStringAsync().Result;

            return(bool.Parse(x));
        }
Ejemplo n.º 2
0
        public ActionResult Bloquer(int id, FormBlocageArbre e)
        {
            if (ModelState.IsValid)
            {
                BlocageArbre ba = new BlocageArbre();
                ba.id         = id;
                ba.idBloqueur = SessionUtilisateur.Utilisateur.id;

                /*object oo = e.blocages.SelectedValue;
                 * oo = e.blocageChoisi;
                 *
                 *
                 * ba.idBlocage = (int)new BlocageServiceAPI().DonnerParNom((string)oo);*/
                ba.idBlocage = e.idBlocage;

                bool b = new ArbreServiceAPI().Bloquer(ba);
                if (b)
                {
                    return(RedirectToAction("ListerTout"));
                }
            }
            return(View(e));
        }
Ejemplo n.º 3
0
 public bool Bloquer(BlocageArbre e)
 {
     return(new ArbreService().Bloquer(e));
 }