コード例 #1
0
        public void Registration(UserDTO User)
        {
            UserAggregate UserAgg = new UserAggregate(new UserEntity()
            {
                ID                 = User.ID,
                UserName           = User.UserName,
                Email              = User.Email,
                PasswordHash       = User.PasswordHash,
                PasswordRepeatHash = User.PasswordRepeatHash,
                IsActive           = true
            });

            List <string> ValidationResult = UserAgg.Validation(ValidationStateEnum.Registation);

            if (ValidationResult.Count == 0)
            {
                var UserData = UserAgg.GetUser();
                _UserRepository.Registration(new UserDTO()
                {
                    ID                 = UserData.ID,
                    UserName           = UserData.UserName,
                    Email              = UserData.Email,
                    PasswordHash       = UserData.PasswordHash,
                    PasswordRepeatHash = UserData.PasswordRepeatHash,
                });
            }
            else
            {
                throw new CustomException(ValidationResult);
            }
        }
コード例 #2
0
        public Guid Login(LoginDTO User)
        {
            UserAggregate UserAgg = new UserAggregate(new UserEntity()
            {
                UserName     = User.UserName,
                PasswordHash = User.PasswordHash
            });

            List <string> ValidationResult = UserAgg.Validation(ValidationStateEnum.Login);

            if (ValidationResult.Count == 0)
            {
                var UserData = UserAgg.GetUser();
                return(_UserRepository.Login(new LoginDTO()
                {
                    UserName = UserData.UserName,
                    PasswordHash = UserData.PasswordHash,
                    SessionID = UserData.SessionID
                }));
            }
            else
            {
                throw new CustomException(ValidationResult);
            }
        }