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

            return(View(rd));
        }
예제 #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
     });
 }
예제 #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
     });
 }
예제 #4
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();
        }
예제 #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));
        }
예제 #6
0
        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();
        }
예제 #7
0
 public BlocageModification(Blocage e)
 {
     this.description = e.description; this.nom = e.nom; this.id = e.id;
 }
예제 #8
0
 public BlocageCreation(Blocage e)
 {
     this.description = e.description; this.nom = e.nom;
 }
예제 #9
0
 public BlocageIndex(Blocage e)
 {
     this.actif = e.actif; this.description = e.description; this.nom = e.nom; this.id = e.id;
 }
예제 #10
0
 public BlocageDetails(Blocage e)
 {
     this.actif = e.actif; this.description = e.description; this.nom = e.nom; this.id = e.id;
 }
예제 #11
0
        public int Creer(Blocage e)
        {
            BlocageService us = new BlocageService();

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

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