i am doing mvc3 and linQ
i have the database like this
class student gender
A john Male
B George Male
A bill Female
A Steve Male
how do i code to filter the duplicate as the result as below
A
John male
bill female
steve male
B
George male
i have tried method A
var bb = from bbb in unitOfWork.Checklists
orderby bbb.class
select bbb;
and also method B
var group = (from p in unitOfWork.Checklists
group p by p.class into g
select new Checklists
{
class= g.Key,
name= g.ToString()
}).AsEnumerable();
but all failed~
Any idea for this ? This is breaking my head!
try to use ObjectDumper project in the visual studio C# sample
The output is
Example MVC code
In your controller
In your view