예제 #1
0
        public MembershipUser CreateUser(string login, string password)
        {
            MembershipUser membershipUser = GetUser(login, false);

            if (membershipUser != null)
            {
                return(null);
            }

            var user = new UserEntity
            {
                Login       = login,
                Password    = Crypto.HashPassword(password),
                DateOfBirth = DateTime.Now
            };

            UserService.CreateEntity(user);

            user = UserService.GetUserEntityByLogin(login);
            RoleService.AddUserEntityToRole(user.Id, "user");

            membershipUser = GetUser(login, false);
            return(membershipUser);
        }