public Account AuthorizedAccount(long accountId) { Account account = null; Repository.Entities.Account entityAccount = accountRepository.Get(accountId); if (entityAccount != null) { account = new Account(entityAccount.id, entityAccount.username, entityAccount.firstname, entityAccount.lastname); } return(account); }
public async Task EventHandle(CreateEvent evt, EventMeta eventBase) { using (var db = this.ServiceProvider.GetService <TransferDbContext>()) { try { var entity = new Repository.Entities.Account() { Id = this.ActorId }; this.accountSnapshotHandler.EntityHandle(entity, evt); db.Accounts.Add(entity); await db.SaveChangesAsync(); } catch (System.Exception e) { e.PGExceptionHandler <AccountDb>(); } } }