Exemple #1
0
        private void InitData()
        {
            //SysUser u = us.Get2(id);
            cmsUser u = us.GetModel(id);

            if (u != null)
            {
                //lblUser.Text = u.cLoginName + " / " + u.cUserName;
                lblUser.Text = u.UName + " / " + u.Name;

                //List<cmsUserRole> ls = urs.GetRolesById(u.iId);
                List <cmsUserRole> ls = urs.GetRolesByUserId(u.Id);

                foreach (ListItem item in cblRoles.Items)
                {
                    if (ls.Exists(delegate(cmsUserRole ur){ return(ur.RoleId == Convert.ToInt64(item.Value)); }))
                    {
                        item.Selected = true;
                    }
                }
            }
        }
Exemple #2
0
        public ActionResult GetRolesByUserId(int userId)
        {
            string jsonStr = userRoleService.GetRolesByUserId(userId);

            return(Content(jsonStr));
        }