public void DeleteStockTransaction(int stockTransactionId) { var stockTransaction = GetStockTransaction(stockTransactionId); if (AccountTransactions.Any(c => c.AccountTransactionId == stockTransaction.AccountTransactionId)) { AccountTransactions.Remove(AccountTransactions.First(c => c.AccountTransactionId == stockTransaction.AccountTransactionId)); } StockTransactions.Remove(stockTransaction); Save(); }
public AccountTransaction GetAccountTransactionByStockTransactionId(int stockTransactionId) { if (AccountTransactions.Any(c => c.StockTransactionId == stockTransactionId)) { var result = AccountTransactions.First(c => c.StockTransactionId == stockTransactionId); if (result.Account == null) { result.Account = GetAccount(result.AccountId); } if (result.StockTransaction == null && result.StockTransactionId.HasValue) { result.StockTransaction = GetStockTransaction(result.StockTransactionId.Value); } return(result); } return(null); }