Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Interface

IAccountManager

Syntax

_accountManagerAccountManager.Register( UserRegistrationContext registrationContext )

Returns

MTOA.DomainObjects.UserTask<User>

API

[POST] /api/v1/account/register

Sample request body

Code Block
{
  "User": {
    "FirstName": "string",
    "LastName": "string",
    "Email": "string",
    "DisplayPhoneNumber": "string"
  },
  "AuthenticationContext": {
    "Type": "GCKey",
    "GCKey": {
      "MBUN": "string",
      "Issuer": "string"
    },
    "WindowsUserName": "string"
  }
}

Returns

UserDTO

Example

Code Block
languagec#
using MTOA.BLL.Interfaces;

var registrationContext = new UserRegistrationContext()
{
    AuthenticationContext = new AuthenticationContext()
    {
        GCKey = "xyz",
        Type = AuthenticationType.GCKey                    
    },
    User = new BareUser()
    {
        Email = "john.doe@tc.gc.ca",
        FirstName = "John",
        LastName = "Done"
    }
};

User user = await _accountManager.Register( registrationContext );

if (user != null)
{
    _logger.Info( $"User {user.FirstName} {user.LastName} was added successfully.");
} else {
    _logger.Error($"Failed to register user.");
}

...