コード例 #1
0
        public ActionResult Create(tblSE SE)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    if (existenceDuSE(SE) == true)
                    {
                        ViewBag.ErreurSE = true;
                        ViewBag.Message  = " Ce système d'exploitation existe déja!!! ";

                        return(View(SE));
                    }
                    else
                    {
                        SE.tagSE = SE.nomSE + SE.editionSE + SE.versionSE;
                        bd.tblSEs.Add(SE);
                        bd.SaveChanges();
                        return(RedirectToAction("Index"));
                    }
                }

                return(View(SE));
            }
            catch
            {
                return(View(SE));
            }
        }
コード例 #2
0
        public ActionResult DeleteConfirmation(int id)
        {
            tblSE SE = bd.tblSEs.Find(id);

            try
            {
                // TODO: Add delete logic here


                if (nombrePlateformeSE(SE) != 0)
                {
                    ViewBag.ErreurSE = true;
                    ViewBag.Message  = " Le système d'exploitation est lié a une ou plusieurs plateformes!!! ";

                    return(View(SE));
                }
                else
                {
                    bd.tblSEs.Remove(SE);

                    bd.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View(SE));
            }
        }
コード例 #3
0
        public ActionResult Edit(tblSE SE)
        {
            // TODO: Add update logic here

            if (ModelState.IsValid)
            {
                if (existenceDuSE(SE) == true)
                {
                    ViewBag.ErreurSE = true;
                    ViewBag.Message  = " Ce système d'exploitation existe déja!!! ";

                    return(View(SE));
                }
                else
                {
                    //SE.tagSE = SE.nomSE + SE.editionSE + SE.versionSE;

                    bd.Entry(SE).State = EntityState.Modified;

                    bd.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }

            return(View(SE));

            /*}
             * catch
             * {
             *  return View(SE);
             * }*/
        }
コード例 #4
0
        private int nombrePlateformeSE(tblSE SE)
        {
            int nbrePlateformeSE        = 0;
            var requeteNbrePlateformeSE = from se in bd.tblSEs
                                          where se.codeSE == SE.codeSE
                                          select se.tblPlateformes.Count();

            foreach (var nombre in requeteNbrePlateformeSE)
            {
                nbrePlateformeSE = nombre;
            }

            return(nbrePlateformeSE);
        }
コード例 #5
0
        private bool existenceDuSE(tblSE SE)
        {
            List <tblSE> listeDesSE     = bd.tblSEs.ToList();
            bool         existeDansLaBD = false;

            foreach (tblSE se in listeDesSE)
            {
                if (se.nomSE == SE.nomSE && se.editionSE == SE.editionSE && se.versionSE == SE.versionSE)
                {
                    existeDansLaBD = true;
                    break;
                }
            }

            return(existeDansLaBD);
        }
コード例 #6
0
        public ActionResult DeleteConfirmation(int id)
        {
            try
            {
                // TODO: Add delete logic here

                tblSE SE = bd.tblSEs.Find(id);
                bd.tblSEs.Remove(SE);
                bd.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #7
0
        public ActionResult Edit(tblSE SE)
        {
            try
            {
                // TODO: Add update logic here

                bd.Entry(SE).State = EntityState.Modified;

                bd.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #8
0
 public ActionResult Create(tblSE SE)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             bd.tblSEs.Add(SE);
             bd.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #9
0
        public ActionResult Edit(tblSE SE)
        {
            try
            {
                SE.tagSE = SE.nomSE + SE.editionSE + SE.versionSE;

                bd.Entry(SE).State = EntityState.Modified;

                bd.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View(SE));
            }
        }
コード例 #10
0
        public ActionResult Index(string texte)
        {
            List <tblSE> listeResultatRechercheSE = new List <tblSE>();
            var          db = new BdTexcel_Eddy_FranckEntities();

            var requeteRechercheSE = from se in db.tblSEs
                                     where se.tagSE.Contains(texte)
                                     select se;

            foreach (var se in requeteRechercheSE)
            {
                tblSE monSE = new tblSE();
                monSE.codeSE    = se.codeSE;
                monSE.nomSE     = se.nomSE;
                monSE.tagSE     = se.tagSE;
                monSE.editionSE = se.editionSE;
                monSE.versionSE = se.versionSE;
                listeResultatRechercheSE.Add(monSE);
            }
            return(View(listeResultatRechercheSE.ToList()));
        }
コード例 #11
0
        private List <tblSE> listeDesSE()
        {
            List <tblSE> listeDesSE = new List <tblSE>();

            var query = from se in bd.tblSEs
                        orderby se.codeSE
                        select se;

            foreach (var se in query)
            {
                tblSE SE = new tblSE();
                SE.codeSE    = se.codeSE;
                SE.nomSE     = se.nomSE;
                SE.editionSE = se.editionSE;
                SE.versionSE = se.versionSE;

                listeDesSE.Add(SE);
            }

            return(listeDesSE);
        }