예제 #1
0
        private void SignUpSectionButton_Click(object sender, RoutedEventArgs e)
        {
            string username             = SignUpSectionUsername.Text;
            string email                = SignUpSectionEmail.Text;
            string password             = SignUpSectionPassword.Password;
            UserSignUpRequestModel user = new UserSignUpRequestModel {
                email = email, username = username, password = password
            };
            bool userIsValid = true;

            if (String.IsNullOrWhiteSpace(username) || String.IsNullOrWhiteSpace(email) || String.IsNullOrWhiteSpace(password))
            {
                userIsValid = false;
                MessageBox.Show("Please fill required fields!");
            }
            else
            {
                if (!this.http.IsValidEmail(email))
                {
                    userIsValid = false;
                    MessageBox.Show("Please enter a valid email!");
                }
                else
                {
                    if (username.Length > 8 || username.Length < 3)
                    {
                        userIsValid = false;
                        MessageBox.Show("Username should be between 3 and 8 characters!");
                    }
                }
            }
            if (userIsValid)
            {
                this.UserSignUp(JsonConvert.SerializeObject(user));
            }
        }
예제 #2
0
        public async Task <UserReadModel> Register([FromBody] UserSignUpRequestModel requestModel)
        {
            var id = await _mediator.Send(new CreateUserCmd(requestModel.Email, requestModel.FirstName, requestModel.LastName, requestModel.PwdHash));

            return(await _query.FindAsync(id));
        }