I have an asp.net mvc project which is divided into projectlayers: Test has the controller which calls the taskproject. In task a function calls the database and returns the data. TestProject:
Homecontroller()
{
public ActionResult Index()
{
List<Person> pers = PersonTask.getPersons();
return View(pers);
}
}
TaskProject:
public static List<Person> getPersons()
{
using (var context = new FilterTestEntities())
{
return context.People.OrderBy(p => p.PersonID).ToList();
}
}
I want to have a filter on the data i return to the controller. I know there is a FilterAttribute, but as far as I know this is only possible on an action function. Is it possible to put a filterAttribute on my getPersons() function. Like:
[PersonFilter]
public static List<Person> getPersons()
Thanks.