/// <summary> /// The create account async. /// </summary> /// <param name="input"> /// The input. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> private async Task CreateAccountAsync(CreateOrUpdateAccountInput input) { var account = input.Account.MapTo <Account>(); account.TenantId = AbpSession.TenantId.Value; await _accountRepository.InsertAsync(account); }
/// <summary> /// The update account async. /// </summary> /// <param name="input"> /// The input. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> private async Task UpdateAccountAsync(CreateOrUpdateAccountInput input) { var account = await _accountRepository.FirstOrDefaultAsync(a => a.Id == input.Account.Id); ObjectMapper.Map(input.Account, account); await _accountRepository.UpdateAsync(account); }
public async Task CreateOrUpdateAccount(CreateOrUpdateAccountInput input) { if (input.Account.Id.HasValue) { await UpdateAccountAsync(input); } else { await CreateAccountAsync(input); } }