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()); }
public IHttpActionResult RemoveUserAccount(Guid userId, string accountType, string name) { if (string.IsNullOrWhiteSpace(accountType)) { throw new ArgumentException("Account type must be defined."); } AccountType type = ParseAccountType(accountType); identityManagementService.RemoveUserAccount(userId, type, name); return(Ok()); }
public IHttpActionResult UpdateUserAccount(Guid userId, UpdateUserAccountCommand command) { if (command == null) { throw new ArgumentNullException("command"); } AccountType type = ParseAccountType(command.Type); identityManagementService.UpdateExternalUserAccount(userId, type, command.Name); return(Ok()); }