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)); }
public ActionResult ListarMenu() { return(Json(MenuBL.Listar().Select(x => new { x.MenuId, Denominacion = x.Modulo + " - " + x.Denominacion }).OrderBy(x => x.Denominacion), JsonRequestBehavior.AllowGet)); }