Why I can't pass a parameter of type Func<MyModel,bool>
from Html.Action
to my Controller
? When I'm trying the following code it gives me error like this:
public PartialViewResult MyMethod(Func<MyModel,bool> lambda)
{
}
And in Razor:
@{var result = Html.Action("MyMethod", "MyController" , new { lambda = c => !c.Checked});}
The error:
Cannot assign lambda expression to anonymous type property
And this is not a duplicate question because that question is looking for why this happens but I'm looking for a solution.