locked
How to order a joined table? RRS feed

  • Question

  • User-991452307 posted

    Hi, 

    I would like to order my data list by date descending based on my joined table of SQL database. 

    I have this code; 

     var dataTransfer2 = dataTransfer.Join(smlPortal.SML_QC_SokuteiRejectsTransaction, a => a.Id, b => b.SokuteiRejectId, (a, b) => new
                {
                    a.Id,
                    a.PlasticNo,
                    a.LotNo,
                    b.transactionBy,
                    b.transactionNotes,
                    b.transactionType,
                    b.transactionDate,
                }).Take(5).ToList();

    Friday, April 2, 2021 1:35 AM

Answers

  • User-991452307 posted

    var dataTransfer2 = dataTransfer.Join(smlPortal.SML_QC_SokuteiRejectsTransaction, a => a.Id, b => b.SokuteiRejectId, (a, b) => new
                {
                    a.Id,
                    a.PlasticNo,
                    a.LotNo,
                    b.transactionBy,
                    b.transactionNotes,
                    b.transactionType,
                    b.transactionDate,
                }).Take(8).OrderByDescending(b => b.transactionDate).ToList();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 2, 2021 4:03 AM