Beispiel #1
0
        public IHttpActionResult AddUserAccount(Guid userId, AddUserAccountCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }
            if (string.IsNullOrWhiteSpace(command.Name))
            {
                throw new ArgumentException("Account name must be defined.");
            }
            if (userId == Guid.Empty)
            {
                throw new ArgumentException("userId must be defined.");
            }

            AccountType type = ParseAccountType(command.Type);

            if (type == AccountType.Password)
            {
                identityManagementService.AddUserAccount(userId, command.Name, command.Password);
            }
            else
            {
                identityManagementService.AddExternalUserAccount(userId, type, command.Name);
            }

            return(Ok());
        }