I have a function that uses Lambda to join 2 tables
the below code is working fine when I try to order by:
List<site> sites = cityContext.sites.OrderBy(x => x.SiteID).ToList();
but when I try to join 2 tables, I am confused with the syntax
List<site> sites = cityContext.sites.Join(cityContext.benches, st => st.SiteID, bh => bh.SiteID, (st, bh) => new { site = st, bench = bh }).select().ToList();
I want to connect 2 tables benches and sites on SiteID.
I have also tried the below code, but I am not getting the same results.
 var sites = (from bs in cityContext.benches
                     join st in cityContext.sites on bs.SiteID equals st.SiteID
                     orderby st.SiteID
                     select new 
                     {
                         st.SiteID,
                         st.Category,
                         st.Borough,
                         st.Type,
                         st.Confirm_Verdict,
                         st.ComDist,
                         st.Bus_Route,
                         st.BID,
                         st.ID,
                         st.Plaza,
                         st.Benches,
                         st.Address,
                         st.Link_Path,
                         st.Directory_Link,
                         st.Street,
                         st.Geocode_Address,
                         st.Zip_Code,
                         st.Description,
                         st.SW_Location,
                         st.X_Street,
                         st.Confirm_Date,
                         st.Installation_Date
                     }).ToList();
 
    