public ActionResult Query(List<string> sortable_bot, List<string> sortable_top)
{
string gro = "from st in context.Customers";
for (int i = 0; i < sortable_top.Count; i++)
{
gro += " group st by st." + sortable_top[i].ToString();
}
string into = " into g select new Group2() { Key = g.Key, Count = g.Count() }";
gro += into;
using (var context = new NwContext())
{
*var que = gro;
return View(que.ToList());
}
}
I put a breakpoint at the star and gro string equals from st in context.Customers group st by st.Country into g select new Group2() { Key = g.Key, Count = g.Count() }
but this is not working. If I write directly like this var que= from st in context.Customers group st by st.Country into g select new Group2() { Key = g.Key, Count = g.Count() }; that worked.
*varbe? Even with dynamic linq you have separate methods.Where(string), .Select(string)...