public Account Save(Account account) { if (_view.AccountId.HasValue) { account = UpdateAccount(account); } else { var accountInserted = InsertAccount(account); _view.AccountId = accountInserted.ID; } return account; }
private Account UpdateAccount(Account account) { account.ID = _view.AccountId.GetValueOrDefault(); return _accountService.Update(account); }
private Account InsertAccount(Account account) { return _accountService.Insert(account); }
private Transaction BuildTransferedTransaction(Account sourceAccount, Transaction transaction) { return new Transaction { Date = transaction.Date, Title = transaction.Title, AccountID = _view.TransferToAccountId, CategoryID = new Guid("8305F6CD-DEE7-4FF4-82FA-B2427E972715"), PayeeID = new Guid("6005D920-6F22-462C-BBA6-A83A3773D4FE"), TransactionDetails = new List<TransactionDetail> { new TransactionDetail { Amount = _view.TransferAmount, IsDeleted = false, Title = string.Format("Transferred from \"{0}\"", sourceAccount.Name), TransactionDetailTypeID = (int) TransactionDetailType.Income } } }; }