public async Task<IActionResult> Register([FromBody] RegisterUserDto user) { var registrationResult = await _userRegisterer.RegisterAsync(user).ConfigureAwait(false); if (registrationResult.IsSuccessful) { // generate a confirmation code and send it to the user's email; var confirmationCode = await _emailConfirmationManager.GenerateConfirmationCodeAsync(registrationResult.Result); var body = await _stringInjector.GetInjectedHtmlFileAsync("EmailConfirmationTemplete.html", confirmationCode); var email = new Email { HtmlBody = body, Subject = "Confirm Your Email", TextBody = "Please confirm your email by using this code: " + confirmationCode }; await _emailSender.SendEmailByEmailAsync(registrationResult.Result.Email, email); return Ok(new { Message = "A user has been created successfuly" }); } return StatusCode((int)registrationResult.Error.StatusCode, registrationResult.Error); }