Ejemplo n.º 1
0
 public override string[] GetRolesForUser(string username)
 {
     //edit
     using (var db = new AptechShoseShopDbContext())
     {
         int userId = int.Parse(username);
         var uu     = db.TbUsers.Find(userId);
         var rs     = uu.UserRoles.Select(y => y.Role.RoleName).ToArray();
         return(rs);
     }
 }
Ejemplo n.º 2
0
        public override bool IsUserInRole(string username, string roleName)
        {
            //edit

            using (var db = new AptechShoseShopDbContext())
            {
                int userId = int.Parse(username);
                var rs     = db.UserRoles.AsEnumerable().Where(x => x.UserId == userId)
                             .Select(x => x.Role.RoleName).Contains(roleName);
                return(rs);
            }
        }