Esempio n. 1
0
        public ActionResult Index()
        {
            EmployeesModel     empModel = new EmployeesModel();
            EmployesRepositery empRp    = new EmployesRepositery();

            empModel.AspNetUsersList = empRp.getAllUsers().ToList();
            empModel.polesList       = empRp.getAllPoles().ToList();
            if (empRp.getAllUsers().ToList().Count() == 0)
            {
                ViewData["erreur"] = "Utilisateurs et des Poles ";
                return(View("ErrorEmptyElement"));
            }
            return(View("EmployesFormulaire", empModel));
        }
Esempio n. 2
0
        public ActionResult CreateEmploye(EmployeesModel empModel)
        {
            EmployesRepositery empRp = new EmployesRepositery();
            Employees          emp   = new Employees();

            if (!ModelState.IsValidField("FirstName") || !ModelState.IsValidField("LastName") ||
                !ModelState.IsValidField("Email") || !ModelState.IsValidField("Telephone"))
            {
                empModel.AspNetUsersList = empRp.getAllUsers().ToList();
                empModel.polesList       = empRp.getAllPoles().ToList();
                return(View("EmployesFormulaire", empModel));
            }
            emp.Employee_ID = Guid.NewGuid();
            String userUmail = Convert.ToString(Request.Form["userList"]);

            emp.User_ID = empRp.getUserByMail(userUmail);
            if (empRp.getAllPoles().ToList().Count() == 0)
            {
                emp.Pole_ID = null;
            }
            else
            {
                emp.Pole_ID = new Guid(Convert.ToString(Request.Form["poleList"]));
            }

            emp.FirstName = Convert.ToString(Request.Form["FirstName"]);
            emp.LastName  = Convert.ToString(Request.Form["LastName"]);
            emp.Email     = Convert.ToString(Request.Form["Email"]);
            emp.Telephone = Convert.ToString(Request.Form["Telephone"]);
            empRp.AddEmployes(emp);
            return(RedirectToAction("AllEmployees"));
        }
Esempio n. 3
0
        public ActionResult createUserRole()
        {
            EmployeesModel     empModel = new EmployeesModel();
            EmployesRepositery empRp    = new EmployesRepositery();

            empModel.AspNetUsersList = empRp.getAllUsers().ToList();
            empModel.polesList       = empRp.getAllPoles().ToList();
            return(View("EmployesFormulaire", empModel));
        }
        public ActionResult RolesUsers()
        {
            RolesRepositery    rolRep = new RolesRepositery();
            EmployesRepositery empRp  = new EmployesRepositery();
            var listRole = rolRep.allRoles();

            if (listRole.Count() == 0)
            {
                ViewData["erreur"] = "Roles";
                return(View("ErrorEmptyElement"));
            }
            foreach (var rl in listRole)
            {
                rl.AspNetUsersList = empRp.getAllUsers().ToList();
            }
            return(View("AddUserRole", listRole.ToList()));
        }