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)); }
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)); }
public bool Bloquer(BlocageArbre e) { return(new ArbreService().Bloquer(e)); }