Exemplo n.º 1
0
        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;

                _logicUser.CreateUserPassThru(toAdd);

                return(RedirectToAction("GetUsers", "User"));
            }
            else
            {
                return(View());
            }
        }
        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());
            }
        }