示例#1
0
        public ActionResult ObtenerRolMenu(int pRolId)
        {
            var rol   = RolBL.Obtener(pRolId);
            var menus = (from of in MenuBL.Listar(x => x.IndPadre.Value == false)
                         join us in RolMenuBL.Listar(x => x.RolId == pRolId) on of.MenuId equals us.MenuId into factDesc
                         from fd in factDesc.DefaultIfEmpty()
                         select new
            {
                of.MenuId,
                Denominacion = of.Modulo + " - " + of.Denominacion,
                Asignado = (fd == null) ? 0 : 1
            }
                         ).ToList();

            return(Json(new
            {
                Rol = rol,
                Menus = menus.OrderBy(x => x.Denominacion)
            }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
 public ActionResult ListarMenu()
 {
     return(Json(MenuBL.Listar().Select(x => new { x.MenuId, Denominacion = x.Modulo + " - " + x.Denominacion }).OrderBy(x => x.Denominacion),
                 JsonRequestBehavior.AllowGet));
 }