示例#1
0
        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();
        }
示例#2
0
 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);
 }