public ActionResult Create(UserCreateCommand userCreateCommand, User currentUser, ProposedUser proposedUser) { Require.NotNull(userCreateCommand, "userCreateCommand"); if (ModelState.IsValid) { IdentityResult identityResult = UserManager.PasswordValidator.ValidateAsync(userCreateCommand.Password).Result; if (identityResult.Succeeded) { string passwordHash = UserManager.PasswordHasher.HashPassword(userCreateCommand.Password); UserService.Create(passwordHash, userCreateCommand.UserContactDto, userCreateCommand.UserDataDto, userCreateCommand.UserPaymentDto, userCreateCommand.UserPermissionDto, new EntityCreatedDto(currentUser, DateTime.Now)); if (proposedUser != null) { ProposedUserService.Delete(proposedUser); } return(RedirectToAction("Index", "UserAdministration")); } AddErrors(identityResult); } UserCreateViewModel userCreateViewModel = new UserCreateViewModel(Roles.AllRoles, userCreateCommand, UserGroupService.GetAll(), proposedUser); return(View(userCreateViewModel)); }
public ActionResult Index(string search, PaginationCommand users) { IPage <User> resultPageUsers = UserService.FindUser(users, search); IList <ProposedUser> proposedUsers = ProposedUserService.GetAll(); UserListViewModel userListModel = new UserListViewModel(resultPageUsers, search, proposedUsers); return(View(userListModel)); }