コード例 #1
0
        public async Task <Account> Handle(CreateAccountCommand request, CancellationToken cancellationToken)
        {
            var account = new Account
            {
                UserId       = request.UserId,
                CreationDate = DateTime.UtcNow,
                LastModified = DateTime.UtcNow,
                ExpiredDate  = DateTime.UtcNow.AddYears(_accountOptions.DefaultLifetimeYear)
            };

            var accountDetail = new AccountDetail
            {
                AccountId        = account.Id,
                Description      = request.Description,
                LimitByOperation = request.LimitByOperation,
                LastModified     = account.LastModified,
                Currency         = request.Currency,
                CreationDate     = account.CreationDate
            };

            account.AccountDetail = accountDetail;

            return(await _table.CreateAsync(account));
        }