Beispiel #1
0
        public ActionResult Details(int id)
        {
            BlocageServiceAPI rsa = new BlocageServiceAPI();
            Blocage           r   = rsa.Donner(id);
            BlocageDetails    rd  = new BlocageDetails(r);

            return(View(rd));
        }
Beispiel #2
0
 public static cl.Blocage VersClient(this Blocage e)
 {
     if (e == null)
     {
         return(null);
     }
     return(new cl.Blocage {
         actif = e.actif, description = e.description, id = e.id, nom = e.nom
     });
 }
Beispiel #3
0
 public static gl.Blocage VersGlobal(this Blocage e)
 {
     if (e == null)
     {
         return(null);
     }
     return(new gl.Blocage {
         id = e.id, nom = e.nom, description = e.description, actif = e.actif ? 1 : 0
     });
 }
        public int Creer(Blocage e)
        {
            string              contenuJson = JsonConvert.SerializeObject(e, Formatting.Indented);
            StringContent       contenu     = new StringContent(contenuJson, Encoding.UTF8, "application/json");
            HttpResponseMessage reponse     = _client.PostAsync($"Blocage/Creer/", contenu).Result;

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

            throw new NotImplementedException();
        }
Beispiel #5
0
        public ActionResult Modifier(int id, BlocageModification rm)
        {
            if (ModelState.IsValid)
            {
                BlocageServiceAPI rsa = new BlocageServiceAPI();
                Blocage           r   = rm.VersBlocage();
                bool b = rsa.Modifier(id, r);
                if (b)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(rm));
        }
        public bool Modifier(int id, Blocage e)
        {
            string              contenuJson = JsonConvert.SerializeObject(e, Formatting.Indented);
            StringContent       contenu     = new StringContent(contenuJson, Encoding.UTF8, "application/json");
            HttpResponseMessage reponse     = _client.PutAsync($"Blocage/Modifier/{id}", 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));

            throw new NotImplementedException();
        }
Beispiel #7
0
 public BlocageModification(Blocage e)
 {
     this.description = e.description; this.nom = e.nom; this.id = e.id;
 }
Beispiel #8
0
 public BlocageCreation(Blocage e)
 {
     this.description = e.description; this.nom = e.nom;
 }
Beispiel #9
0
 public BlocageIndex(Blocage e)
 {
     this.actif = e.actif; this.description = e.description; this.nom = e.nom; this.id = e.id;
 }
Beispiel #10
0
 public BlocageDetails(Blocage e)
 {
     this.actif = e.actif; this.description = e.description; this.nom = e.nom; this.id = e.id;
 }
        public int Creer(Blocage e)
        {
            BlocageService us = new BlocageService();

            return(us.Creer(e.VersClient()));
        }
        public bool Modifier(int id, Blocage e)
        {
            BlocageService us = new BlocageService();

            return(us.Modifier(id, e.VersClient()));
        }