System.Collections.Generic.List.Add(role)

Here are the examples of the csharp api System.Collections.Generic.List.Add(role) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6 Examples 7

19 View Source File : userRoleEx.cs
License : MIT License
Project Creator : ecjtuseclab

public List<role> getUserRole(int userid)
        {
            List<role> rr = new List<role>();

            rr = db.Queryable<role>()
                   .JoinTable<user_role>((s1, s2) => s1.id == s2.roleid)
                   .Where<user_role>((s1, s2) => s2.userid == userid)
                   .Select("s1.*")
                   .ToList();

            List<role> Irr = new List<role>();
            foreach (role r in rr)
            {
                Irr.Add(r as role);
            }
            return Irr;
        }

19 View Source File : userRoleEx.cs
License : MIT License
Project Creator : ecjtuseclab

public List<role> getRoleList(int id)
        {
            List<role> rr = new List<role>();
            user uu = db.Queryable<user>().Where(d => d.id == id).FirstOrDefault();
            if (uu != null)
                rr = db.Queryable<role>()
                    .JoinTable<user_role>((s1, s2) => s1.id == s2.roleid)
                    .Where<user_role>((s1, s2) => s2.userid == uu.id)
                    .Select("s1.*")
                    .ToList();
            List<role> Irr = new List<role>();
            foreach (role r in rr)
            {
                Irr.Add(r as role);
            }
            return Irr;
        }

19 View Source File : userRoleEx.cs
License : MIT License
Project Creator : ecjtuseclab

public List<role> getRole(string username)
        {
            List<role> rr = new List<role>();
            user uu = db.Queryable<user>().Where(d => d.username == username).FirstOrDefault();
            if (uu != null)
                rr = db.Queryable<role>()
                    .JoinTable<user_role>((s1, s2) => s1.id == s2.roleid)
                    .Where<user_role>((s1, s2) => s2.userid == uu.id)
                    .Select("s1.*")
                    .ToList();
            List<role> Irr = new List<role>();
            foreach (role r in rr)
            {
                Irr.Add(r as role);
            }
            return Irr;
        }

19 View Source File : roleEx.cs
License : MIT License
Project Creator : ecjtuseclab

public List<role> getUserRoles(string userName)
        {
            //List<role> roles = db.Queryable<role>().
            //    JoinTable<user_role>((s1, s2) => s1.id == s2.roleid)
            //    .JoinTable<user_role, user>((s1, s2, s3) => s2.userid == s3.id)
            //    .Where<user_role, user>((s1, s2, s3) => s3.username == userName)
            //    .Select<role>("s1.*")
            //    .ToList();
            //return roles;
            List<role> rr = new List<role>();
            user uu = db.Queryable<user>().Where(d => d.username == userName).FirstOrDefault();
            if (uu != null)
                rr = db.Queryable<role>()
                    .JoinTable<user_role>((s1, s2) => s1.id == s2.roleid)
                    .Where<user_role>((s1, s2) => s2.userid == uu.id)
                    .Select("s1.*")
                    .ToList();
            List<role> Irr = new List<role>();
            foreach (role r in rr)
            {
                Irr.Add(r as role);
            }
            return Irr;
        }

19 View Source File : roleEx.cs
License : MIT License
Project Creator : ecjtuseclab

public List<role> getUserRoles(string userName)
        {
            try
            {
                List<role> rr = new List<role>();
                user uu = db.Queryable<user>().Where(d => d.username == userName).FirstOrDefault();
                if (uu != null)
                    rr = db.Queryable<role>()
                        .JoinTable<user_role>((s1, s2) => s1.id == s2.roleid)
                        .Where<user_role>((s1, s2) => s2.userid == uu.id)
                        .Select("s1.*")
                        .ToList();
                List<role> Irr = new List<role>();
                foreach (role r in rr)
                {
                    Irr.Add(r as role);
                }
                return Irr;
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                return null;
            }

        }

19 View Source File : selectroleControler.cs
License : MIT License
Project Creator : ecjtuseclab

public override void view()
        {
            List<role> roles=new List<role>();
            List<user_role> user_roles = IocModule.GetEnreplacedy<IuserRoleEx>().getRole(accctx.currentuser.id);
            foreach (var item in user_roles)
	        {
		       role r= IocModule.GetEnreplacedy<IroleEx>().getRole(item.roleid);
               roles.Add(r);
	        }
            tp.Put("username", accctx.currentuser.username);
            tp.Put("rolelist", roles);
            tp.Display(ctx, "../selectrole.html");
        }