Beispiel #1
0
        public string[] gerRolesForUser(string userName)
        {
            string[] result;
            using (context = new cineEntities())
            {
                result = context.sp_getRolesForUser(userName).ToArray();
            }


            return(result);
        }
Beispiel #2
0
        public bool isUserInRole(string userName, string roleName)
        {
            bool result = false;


            using (context = new cineEntities())
            {
                result = (bool)context.sp_isUserInRole(userName, roleName).First();
                //  result  = (bool)context.sp_isUserInRole(userName, roleName).FirstOrDefault();
            }

            return(result);
        }
Beispiel #3
0
 public Users getUser(string userName)
 {
     try
     {
         Users resultado;
         using (cineEntities nose = new cineEntities())
         {
             Expression <Func <Users, bool> > consulta = (u => u.UserName.Equals(userName));
             resultado = nose.Set <Users>().Where(consulta).ToList().FirstOrDefault();
         }
         return(resultado);
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #4
0
        public List <Users> getUsuariosRole(string roleName)
        {
            List <Users>  result = new List <Users>();
            List <string> lista;

            using (context = new cineEntities())
            {
                lista = context.sp_getUsuariosRole(roleName).ToList();
                Users user;
                foreach (var item in lista)
                {
                    user = this.getUser(item);
                    result.Add(user);
                }
            }


            return(result);
        }