Entity FrameWork Query

Oct 13 2021 4:55 PM
Serial Number CHECK_NUMBER CHECK_VERSION ROUTING_NUMBER TRANSACTION_SEQUENCE
1 09172113334652298482 New 615114379 1
2 03346522984829172113 New 679151143 2
3 02113391784823465229 New 619511437 3
4 09172113334652298482 Old 615114379 2
5 03346522984829172113 Old 679151143 3
6 02113391784823465229 Old 619511437 4

For My  Entity FrameWork, in the For Loop

While working Evaluating, serial number 4 5 and 6

I should get the previous Tansaction(Transaction Sequence - 1) row

Ex: for SerialNumber 4, the previuos transaction is 1, same way for 5 its 2 and for 6 its 3

I tried below, it did not work

var previousTransactions = transactions
    .Where(pt => pt.Check_Number == t. Check_Number
    //&& pt.Check_Version == t. pt.Check_Version
    && pt.Transaction_Sequence == Transaction_Sequence).FirstOrDefault();
    //.OrderByDescending(pt => pt.Sequence_Number).FirstOrDefault());
    .Distinct(new TransactionComparer());
}

 


Answers (1)