Esempio n. 1
0
        public List <InfirmierViewModel> getListInfirmiers()
        {
            var listPersonne = db.infirmiers.ToList();
            List <InfirmierViewModel> lesInfirmiers = new List <InfirmierViewModel>();

            foreach (var x in listPersonne)
            {
                InfirmierViewModel inf = new InfirmierViewModel();
                var i = db.personnes.Find(x.idInf);

                inf.idPers            = i.idPers;
                inf.nomPers           = i.nomPers;
                inf.adressePers       = i.adressePers;
                inf.cniPers           = i.cniPers;
                inf.dateNaissancePers = i.dateNaissancePers;
                inf.emailPers         = i.emailPers;
                inf.prenomPers        = i.prenomPers;
                inf.sexePers          = i.sexePers;
                inf.situationMatPers  = i.situationMatPers;
                inf.specialteInf      = x.specialteInf;
                inf.telPers           = i.telPers;
                lesInfirmiers.Add(inf);
            }
            return(lesInfirmiers);
        }
Esempio n. 2
0
        public ActionResult Create([Bind(Include = "idPers,nomPers,prenomPers,adressePers,dateNaissancePers,sexePers,cniPers,situationMatPers,emailPers,telPers,specialteInf")] InfirmierViewModel infirmierViewModel)
        {
            if (ModelState.IsValid)
            {
                Personne p = new Personne();
                p.adressePers       = infirmierViewModel.adressePers;
                p.cniPers           = infirmierViewModel.cniPers;
                p.dateNaissancePers = infirmierViewModel.dateNaissancePers;
                p.emailPers         = infirmierViewModel.emailPers;
                p.nomPers           = infirmierViewModel.nomPers;
                p.prenomPers        = infirmierViewModel.prenomPers;
                p.sexePers          = infirmierViewModel.sexePers;
                p.situationMatPers  = infirmierViewModel.situationMatPers;
                p.telPers           = infirmierViewModel.telPers;
                db.personnes.Add(p);
                db.SaveChanges();
                Infirmier inf = new Infirmier();
                inf.idInf        = p.idPers;
                inf.specialteInf = infirmierViewModel.specialteInf;
                db.infirmiers.Add(inf);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(infirmierViewModel));
        }
Esempio n. 3
0
        // GET: Infirmier/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InfirmierViewModel infirmierViewModel = getListInfirmiers().Where(a => a.idPers == id).FirstOrDefault();

            if (infirmierViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(infirmierViewModel));
        }