예제 #1
0
        private async Task <object> SignUp()
        {
            var model = this.BindAndValidate <SignUpViewModel>();

            if (!ModelValidationResult.IsValid)
            {
                return(Negotiate
                       .WithModel(ModelValidationResult.FormattedErrors)
                       .WithStatusCode(HttpStatusCode.UnprocessableEntity));
            }

            var command = new SignUpCommand(
                model.Username,
                model.Email,
                hashingService.HashPassword(model.Password)
                );

            await busClient.Send(command);

            return(HttpStatusCode.Accepted);
        }
예제 #2
0
 public static string HashPassword(this IAccountCredentials credentials)
 {
     return(HashingService.HashPassword(credentials));
 }