public ActionResult Index() { if (this.User != null) { var account = this.database.AccountRepository.GetByLogin(this.User.Identity.Name); if (account == null) { throw new Exception(string.Format("User [{0}] not found", this.User.Identity.Name)); } var history = this.database.PaymentRepository.GetAllForUser(account.Id).ToList() .Select(e => new PaymentHistoryItemViewModel { Ammount = e.Ammount, Direction = e.CorrespondentUserId == account.Id ? PaymentDirection.In : PaymentDirection.Out, OtherUserName = e.CorrespondentUserId != account.Id ? e.CorrespondentUser.UserName : e.SenderUser.UserName, CreatedUtc = e.CreatedUtc, State = e.State.Name }).ToList(); var vm = new AccountStateViewModel { Name = account.UserName, Balance = account.Balance, History = history }; return(View(vm)); } return(null); }
private void PublishToKafka(PublishAccountStateToKafka msg) { ParentName = Self.Path.Parent.Name.Contains("$") ? ParentName : Self.Path.Parent.Name; var kafkaAccountModel = new AccountStateViewModel ( accountNumber: _accountState.AccountNumber, userName: _accountState.UserName, portfolioName: ParentName, //Self.Path.Parent.Name, currentBalance: _accountState.CurrentBalance, accountStatus: _accountState.AccountStatus, asOfDate: DateTime.Now, lastPaymentDate: _accountState.LastPaymentDate, lastPaymentAmount: (decimal)_accountState.LastPaymentAmount, daysDelinquent: DateTime.Now.Subtract(_accountState.LastPaymentDate).Days, accountInventory: _accountState.Inventroy ); AccountStatePublisherActor.Tell(new Publish(kafkaAccountModel.AccountNumber, kafkaAccountModel)); _log.Debug($"[PublishToKafka]: Sending kafka message for account {kafkaAccountModel}"); }