<div mvc-lookup-for="Id" url="People" sort="Income" order="LookupSortOrder.Desc"></div>
public class HomeController : Controller
{
private DbContext Context { get; }
public HomeController(DbContext context)
{
Context = context;
}
[HttpGet]
public JsonResult People(LookupFilter filter)
{
return Json(new PeopleLookup(Context) { Filter = filter }.GetData());
}
}
public class PeopleLookup : ALookup<Person>
{
private DbContext Context { get; }
public PeopleLookup(DbContext context)
{
Context = context;
FilterCase = LookupFilterCase.Lower;
}
public override IQueryable<Person> GetModels()
{
return Context.Set<Person>();
}
}