mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00:00
fix contest submissions
This commit is contained in:
parent
a4a75f39bb
commit
52d46877c9
1 changed files with 11 additions and 1 deletions
|
@ -76,9 +76,19 @@ public Role HighestRole
|
||||||
var roleList = new List<Role>();
|
var roleList = new List<Role>();
|
||||||
foreach (var role in this.Roles)
|
foreach (var role in this.Roles)
|
||||||
{
|
{
|
||||||
roleList.Add(new ApplicationDbContext().Roles.First(r => r.Id == role.RoleId) as Role);
|
var found = (new ApplicationDbContext().Roles.FirstOrDefault(r => r.Id == role.RoleId) as Role);
|
||||||
|
if (found != null)
|
||||||
|
roleList.Add(found);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(roleList.Count()==0)
|
||||||
|
{
|
||||||
|
var roles = new List<Role>();
|
||||||
|
var db = new ApplicationDbContext();
|
||||||
|
foreach (var r in db.Roles.ToArray())
|
||||||
|
roles.Add(r as Role);
|
||||||
|
return roles.OrderBy(x => x.Priority).First();
|
||||||
|
}
|
||||||
return roleList.OrderByDescending(x => x.Priority).First();
|
return roleList.OrderByDescending(x => x.Priority).First();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue