suman goud

suman goud

  • NA
  • 176
  • 52.8k

How to insert data in two rows (debit and credit) on save

Aug 16 2016 5:52 AM
i have two dropdowns and amount in my page
1.Account
2.ContraAccount 
3.Amount
when i save this details  i want to insert in database like,
 
Amount should debit from Account(1 row),and amount should credit in another account(2nd row)  
 
Account   ContrAccoutn   Debit   Credit    
 Cash         A                       100         0
A                 Cash                 0         100
 
 my controller code
 
var Ledger = db.LedgerTables.Create();
Ledger.AccountID = strddlAccount;
Ledger.ContraAccountID = strddlCustomer;
Ledger.Debit = transactionGInfo.Amount;
db.LedgerTables.Add(Ledger);
db.SaveChanges();

Answers (3)