Esempio n. 1
0
        public static List <Commons.Role> Get(Int32?IdRole)
        {
            List <Commons.Role> obj = new List <Commons.Role>();

            using (IndexEntities db = new IndexEntities())
            {
                List <spg_Role_Result> result = db.spg_Role(IdRole).ToList();
                result.ForEach(x => {
                    obj.Add(new Commons.Role()
                    {
                        Id          = x.Id,
                        Name        = x.Name,
                        Description = x.Description,
                        Premisions  = Premission.Get(x.Id)
                    });
                });
            }

            return(obj);
        }
Esempio n. 2
0
        public static List <Commons.UserByRole> GetToAssign(String UserName)
        {
            List <Commons.UserByRole> obj = new List <Commons.UserByRole>();

            using (IndexEntities db = new IndexEntities())
            {
                List <spg_RoleByUserToAssign_Result> result = db.spg_RoleByUserToAssign(UserName).ToList();
                result.ForEach(x => {
                    obj.Add(new Commons.UserByRole()
                    {
                        Id           = x.Id,
                        Name         = x.Name,
                        Description  = x.Description,
                        Premisions   = Premission.Get(x.Id),
                        RoleAssigned = (x.RoleAssigned == 1) ? true : false
                    });
                });
            }

            return(obj);
        }