public ActionResult CreateUser()
        {
            RoleListVM list = new RoleListVM(roleBL.GetRolesPassThru());

            ViewBag.Roles = new SelectList(list.ListOfRoleModels, "RoleID", "RoleName");
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult ExampleView()
        {
            var        list = _logic.GetRolesPassThru();
            RoleListVM vm   = new RoleListVM(list);

            return(View(vm));
        }
        public ActionResult GetRoles()
        {
            List <Role> _list = roleBL.BLGetRoles();
            RoleListVM  model = new RoleListVM(_list);

            return(View(model));
        }
Ejemplo n.º 4
0
        public ActionResult UpdateUser(UserModel model, int id, int roleID)
        {
            RoleListVM list = new RoleListVM(roleBL.BLGetRoles());

            ViewBag.Roles   = new SelectList(list.ListOfRoleModels, "RoleId", "RoleName");
            model.UserID    = id;
            model.RoleID_FK = roleID;
            return(View(model));
        }
Ejemplo n.º 5
0
        public ActionResult UpdateUser(UserModel model, int id, int roleID)
        {
            RoleListVM list = new RoleListVM(_logicRole.GetRolesPassThru());

            ViewBag.Roles = new SelectList(list.ListOfRoleModel, "RoleId", "RoleName");

            model.UserId = id;
            model.RoleId = roleID;
            return(View(model));
        }
Ejemplo n.º 6
0
        public ActionResult GetRoles()
        {
            RoleListVM model;

            try
            {
                List <Role> list = _logic.GetRolesPassThru();
                model = new RoleListVM(list);
            }
            catch (Exception)
            {
                // TODO: log error if no is thrown
                throw;
            }
            return(View(model));
        }
        public ActionResult UpdateUser(int id)
        {
            RoleListVM list = new RoleListVM(roleBL.GetRolesPassThru());

            ViewBag.Roles = new SelectList(list.ListOfRoleModels, "RoleID", "RoleName");

            List <User> _list      = userBL.GetUsersPassThru();
            UserListVM  model      = new UserListVM(_list);
            UserModel   updateUser = new UserModel();

            foreach (var i in model.ListOfUserModels)
            {
                if (id == i.UserID)
                {
                    updateUser = i;
                }
            }
            return(View(updateUser));
        }
        public ActionResult CreateUser(UserModel model)
        {
            if (ModelState.IsValid)
            {
                User toAdd = new User();

                toAdd.FirstName = model.FirstName;
                toAdd.LastName  = model.LastName;
                toAdd.UserName  = model.UserName;
                toAdd.Password  = model.Password;
                toAdd.RoleID_FK = model.RoleID_FK;

                userBL.CreateUserPassThru(toAdd);

                return(RedirectToAction("GetUsers", "User"));
            }
            else
            {
                RoleListVM list = new RoleListVM(roleBL.GetRolesPassThru());
                ViewBag.Roles = new SelectList(list.ListOfRoleModels, "RoleID", "RoleName");
                return(View());
            }
        }