I want to generate a LINQ statement like this type of SQL statement
SELECT *
FROM   dbo.tbl_Advertisement
WHERE  FileName LIKE '%latest%'
       AND ToDate = (SELECT min(ToDate)
                     FROM   dbo.tbl_Advertisement
                     WHERE  CAST (getdate() AS DATE) <= CAST (Todate AS DATE)
                            AND FromDate = (SELECT max(FromDate)
                                            FROM   dbo.tbl_Advertisement
                                            WHERE  CAST (getdate() AS DATE) >= CAST (FromDate AS DATE)));
I have generated Linq statement as followes:
objAdvList = objAdvList
            .Where(x => x.ToDate == Convert.ToDateTime(objAdvList
                .Where(y => y.FromDate == Convert.ToDateTime(objAdvList.Max(z => z.FromDate)))
                .Select(y => y.FromDate)
                ))
                .Select(x => x)
                .ToList();
Where objAdvList is a List type collection of
class AdvertisementAccess
{
    public DateTime FromDate { get; set; }
    public DateTime ToDate { get; set; }
    public string FileName { get; set; }
    public string Path { get; set; }
}
But this code give me an error message as followes:
Unable to cast object of type 'WhereSelectListIterator`2[AdvertisementAccess,System.DateTime]' to type 'System.IConvertible'.
Is there anyone to solve my problem?
Regards, Mayank