Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Employe_Role employe_role = db.Employe_Role.Find(id);

            db.Employe_Role.Remove(employe_role);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
        //
        // GET: /EmployeRole/Details/5

        public ActionResult Details(int id = 0)
        {
            Employe_Role employe_role = db.Employe_Role.Find(id);

            if (employe_role == null)
            {
                return(HttpNotFound());
            }
            return(View(employe_role));
        }
Example #3
0
 public ActionResult Edit(Employe_Role employe_role)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employe_role).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EmployeRefId = new SelectList(db.Employe, "EmployeID", "Nom", employe_role.EmployeRefId);
     ViewBag.RoleRefId    = new SelectList(db.Roles, "RoleId", "Titre", employe_role.RoleRefId);
     return(View(employe_role));
 }
Example #4
0
        //
        // GET: /EmployeRole/Edit/5

        public ActionResult Edit(int id = 0)
        {
            Employe_Role employe_role = db.Employe_Role.Find(id);

            if (employe_role == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EmployeRefId = new SelectList(db.Employe, "EmployeID", "Nom", employe_role.EmployeRefId);
            ViewBag.RoleRefId    = new SelectList(db.Roles, "RoleId", "Titre", employe_role.RoleRefId);
            return(View(employe_role));
        }
Example #5
0
        //
        // GET: /Employe/

        public ActionResult Index(string metierid, string employeid, string debut_metier, string fin_metier, string roleid)
        {
            var employes = from s in db.Employe
                           select s;

            if (!String.IsNullOrEmpty(metierid) && !String.IsNullOrEmpty(employeid))
            {
                Metier         metier = db.Metier.Find(Int32.Parse(metierid));
                Employe_Metier em     = new Employe_Metier();

                DateTime dt_debut = DateTime.ParseExact(debut_metier,
                                                        "yyyy-MM-dd", CultureInfo.InvariantCulture);

                DateTime dt_fin = DateTime.ParseExact(fin_metier,
                                                      "yyyy-MM-dd", CultureInfo.InvariantCulture);


                Employe employe = db.Employe.Find(Int32.Parse(employeid));
                if (employe != null && metier != null)
                {
                    em.Employe     = employe;
                    em.Metier      = metier;
                    em.DebutMetier = dt_debut;
                    em.FinMetier   = dt_fin;
                    db.Employe_Metier.Add(em);
                    db.SaveChanges();
                }
            }
            if (!String.IsNullOrEmpty(roleid) && !String.IsNullOrEmpty(employeid))
            {
                ViewData["employeid"] = employeid;
                ViewData["roleid"]    = roleid;
                Roles        role = db.Roles.Find(Int32.Parse(roleid));
                Employe_Role er   = new Employe_Role();


                Employe employe = db.Employe.Find(Int32.Parse(employeid));
                if (employe != null && role != null)
                {
                    er.Employe = employe;
                    er.Role    = role;
                    db.Employe_Role.Add(er);
                    db.SaveChanges();
                }
            }
            return(View(employes));
        }