public void Handle(CreateAccount command) { var newAccountNumber = _accountNumberGenerator.GenerateAccountNumber(); var account = new Account(command.BusinessName, newAccountNumber, command.NewAccountId); _accountStore.Save(account); }
public void Handle(ReinstateAccount command) { var account = _accountStore.GetById(command.AccountId); account.Reinstate(); _accountStore.Save(account); }
public void Handle(DeleteAccount command) { var account = _accountStore.GetById(command.AccountId); account.Delete(command.Reason); _accountStore.Save(account); }
public void Handle(ApproveAccount command) { var account = _accountStore.GetById(command.AccountId); account.Approve(command.ApprovedBy); _accountStore.Save(account); }
public void Handle(UpdateAccountAddress command) { var account = _accountStore.GetById(command.AccountId); account.ChangeAddress(command.AddressLine1, command.AddressLine2, command.City, command.Postcode, command.State, command.CountryName); _accountStore.Save(account); }
public async Task <AccountCode> GenerateAccountCodeWithHashAsync(string accountHash) { Data.AccountCode accountCode = new Data.AccountCode { Hash = accountHash, Code = _rand.Next(100000, 1000000), WhenCreated = DateTime.UtcNow }; await _store.Save(accountCode); return(Mapper.Map <AccountCode>(accountCode)); }
private Account FindOrCreate(string name) { var account = _accountStore.GetAll() .SingleOrDefault(a => a.CompanyId == _companyId && a.Description == name); if (account == null) { account = new Account { CompanyId = _companyId, CreatedOn = DateTime.Now, CreatedBy = "IMPORT", Balance = 0, Description = name, }; _accountStore.Save(account); account = _accountStore.Get(account.AccountId); } return(account); }
public void Save(Account account, string serviceId) { xAccountStore.Save(account, serviceId); }
/// <summary> /// 保存账号信息,默认会覆盖掉本地的账号信息 /// </summary> /// <param name="path"></param> /// <param name="accountName"></param> /// <param name="account"></param> public void Save(string path, string accountName, IAccount account) { accountStore.Save(path, accountName, (Account)account); }