Example #1
0
        public ActionResult PagesRoles(int value)
        {
            try
            {
                // int userid = 14;
                var    val      = "13";
                string rolename = "";
                pages.id = value;
                // pages.PageName = val;

                var result = (from a in db.PageAuthentications
                              join c in db.Roles on a.RoleId equals c.RoleId
                              join b in db.Pags on a.PageName equals b.PageName
                              where b.id == pages.id
                              select new Models.GetAssignPages {
                    pageid = b.id, Roleid = c.RoleId.ToString(), Rolename = c.RoleName
                }).ToList();

                {
                }
                var        pageroles = DataReaders.buildPagesList(pages);
                var        roles     = DataReaders.buildAllRoleList();
                List <int> pagerole  = pageroles;
                List <int> role      = roles;
                var        newList   = roles.Except(pageroles);

                var pageurl = (from p in db.Roles
                               where newList.Contains((int)(p.RoleId))
                               select new Models.UnGetAssignRoles {
                    Roleid = p.RoleId, Rolename = p.RoleName
                }).ToList();
                var model = new LoanViewModel
                {
                    GetAssignPagess   = result.ToList(),
                    UnGetAssignRoless = pageurl.ToList(),
                };


                return(View(model));
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }