/// <summary> /// The add sub administrator account. /// </summary> /// <param name="account"> /// The account. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task<Status> AddSubAdministratorAccount(AccountWithPhoneNumber account) { return await _apiClient.PostAsync<AccountWithPhoneNumber, Status>( ApiUris.AccountWithPhoneNumber(_apiClient.OrganizationId), account); }
/// <summary> /// This function updates an existing Administrator Account. /// </summary> /// <param name="account"> /// The account to be updated. /// </param> /// <returns> /// A <see cref="Status"/> object instance that shows the results of the operation. /// </returns> public async Task<Status> UpdateAdministratorAccount(AccountWithPhoneNumber account) { var parameters = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(account.password)) parameters["password"] = account.password; if (!string.IsNullOrEmpty(account.emailAddress)) parameters["emailAddress"] = account.emailAddress; if (!string.IsNullOrEmpty(account.fullName)) parameters["fullName"] = account.fullName; if (!string.IsNullOrEmpty(account.firstName)) parameters["firstName"] = account.firstName; if (!string.IsNullOrEmpty(account.lastName)) parameters["lastName"] = account.lastName; if (!string.IsNullOrEmpty(account.department)) parameters["department"] = account.department; if (!string.IsNullOrEmpty(account.customDefined1)) parameters["customDefined1"] = account.customDefined1; if (!string.IsNullOrEmpty(account.customDefined2)) parameters["customDefined2"] = account.customDefined2; if (!string.IsNullOrEmpty(account.phoneCountryCode)) parameters["phoneCountryCode"] = account.phoneCountryCode; if (!string.IsNullOrEmpty(account.phoneNumber)) parameters["phoneNumber"] = account.phoneNumber; string postBody = parameters.ToQueryString(); if (account.MemberOfRoles.Any()) { IEnumerable<string> roles = account.MemberOfRoles.Select(role => string.Format("role={0}", role.Name)); string roleParameters = string.Join("&", roles); postBody = string.Join("&", postBody, roleParameters); } return await WebApi.ApiPostAsync<Status>(ApiUris.UpdateAdministrator(Account.OrganizationId, account.userName), postBody); }
public async Task<Status> UpdateAdministratorAccount(AccountWithPhoneNumber account) { return await Account.UpdateAdministratorAccount(account); }
/// <summary> /// Try to login into the account using the credentials. /// If succeed, it will return the account details. /// </summary> /// <param name="connection"> /// The connection. /// </param> /// <returns> /// The CaaS connection /// </returns> private async Task<Status> ResetPasswordTask(ComputeServiceConnection connection) { var account = new AccountWithPhoneNumber { userName = connection.Account.UserName, password = NewPassword.ToPlainString() }; return await connection.ApiClient.UpdateAdministratorAccount(account); }