The error I am facing is
Delegate ‘System.Func< MyWebSiteApp.Models.FontCategory,int,bool >’
does not take 1 arguments
var s = db.FontCategories.Include("Fonts").
Where(s=>s.Fonts.Where(s=>s.Inactive == false).ToList();
Any clu how to fix it?
I think you’re after the Linq Any. This will return the font categories that contain at least one active font:
The problem with your existing code is that Where expects a
Predicate<FontCategory>type (ie, a lambda that returns true/false), but your lambda returnsIEnumerable<Font>instead. Hence the error.From the documentation for Any: