gift

gift

  • NA
  • 42
  • 827

Assign people to different groups using asp.net mvc C#

May 19 2015 11:00 AM
I want to assign people to different groups based on their scores, from a table called "people" to another table called "grouping"  starting from the highest score. There are 80 people I want the first 20 candidates with the highest score assigned to “Group A”, the next 20 to ” Group B”, the next 20 to ” Group C” and so on. Am using asp.net MVC and C#
 
Database Name : peopleDB
Fields in people table
peopleID
Firstname
Lastname
scoresobtained
Grouping Table
Firstname
Lastname
group
 
 
In my Controller
public ActionResult autoassign()
{
var rc = new peopleDBEntities();
var res = (from p in rc.people
orderby p.scoresobtained descending
select new
{
firstname = p.firstname.ToString(),
lastname = p.lastname.ToString(),
score = f.canditatescores.ToString(),
});
in my controller as shown above, i have retrieved the values from people table from highest scores.(descending) how do iterate to pare them into groups of 20 each.  i do not know how to go about it. so please help. I am using asp.net mvc in C#
 

Answers (1)