public override void AddUsersToRoles(string[] usernames, string[] roleNames)
{
string[] allRoles = GetAllRoles();
IEnumerable<string> roles = allRoles.Intersect(roleNames);
if(roles.Any())
{
using (var db = new EEGScreeningEntities())
{
List<int> mlist = (from m in db.aspnet_Users
where usernames.Contains(m.UserName)
select m.UserId).ToList();
List<int> glist = (from g in db.aspnet_Roles
where roleNames.Contains(g.RoleName)
select g.RoleId).ToList();
var mglist = (from m in mlist from g in glist select new User_In_Roles {UserId = m, RoleId = g }).FirstOrDefault();
db.User_In_Roles.AddObject(mglist);
db.SaveChanges();
}
}</int></int></string>
is there to condense this.