public override string[] GetAllRoles()
 {
     using (var dbContext = new ItemDBEntities())
     {
         return dbContext.Roles.Select(r => r.Name).ToArray();
     }
 }
 public override bool IsUserInRole(string username, string roleName)
 {
     using (var dbContext = new ItemDBEntities())
     {
         var user = dbContext.Users.SingleOrDefault(u => u.Username == username);
         if (user == null)
             return false;
         return user.UserRoles != null && user.UserRoles.Select(u => u.Role).Any(r => r.Name == roleName);
     }
 }
 public override string[] GetRolesForUser(string username)
 {
     using (var dbContext = new ItemDBEntities())
     {
         var user = dbContext.Users.SingleOrDefault(u => u.Username == username);
         if (user == null)
             return new string[] { };
         return user.UserRoles == null ? new string[] { } :
           user.UserRoles.Select(u => u.Role).Select(u => u.Name).ToArray();
     }
     
 }