public async Task <IActionResult> Index()
        {
            OperatorInfo operatorInfo = await _operator.Current();

            if (operatorInfo == null)
            {
                LogHelper.Debug("User Not Login. Redirect to Login page.");
                return(RedirectToAction("Login"));
            }
            TData <List <MenuEntity> > objMenu = await menuBLL.GetList(null);

            List <MenuEntity> menuList = objMenu.Data;

            menuList = menuList.Where(p => p.MenuStatus == StatusEnum.Yes.ParseToInt()).ToList();

            if (operatorInfo.IsSystem != 1)
            {
                TData <List <MenuAuthorizeInfo> > objMenuAuthorize = await menuAuthorizeBLL.GetAuthorizeList(operatorInfo);

                List <long?> authorizeMenuIdList = objMenuAuthorize.Data.Select(p => p.MenuId).ToList();
                menuList = menuList.Where(p => authorizeMenuIdList.Contains(p.Id)).ToList();
            }

            ViewBag.MenuList     = menuList;
            ViewBag.OperatorInfo = operatorInfo;
            return(View());
        }
Beispiel #2
0
        public async Task <IActionResult> GetUserAuthorizeJson()
        {
            TData <UserAuthorizeInfo> obj = new TData <UserAuthorizeInfo>();
            OperatorInfo operatorInfo     = await _operator.Current();

            TData <List <MenuAuthorizeInfo> > objMenuAuthorizeInfo = await _menuAuthorizeBll.GetAuthorizeList(operatorInfo);

            obj.Data          = new UserAuthorizeInfo();
            obj.Data.IsSystem = operatorInfo.IsSystem;
            if (objMenuAuthorizeInfo.Tag == 1)
            {
                obj.Data.MenuAuthorize = objMenuAuthorizeInfo.Data;
            }
            obj.Tag = 1;
            return(Json(obj));
        }
Beispiel #3
0
        public async Task <IActionResult> Index()
        {
            OperatorInfo operatorInfo = await Operator.Instance.Current();

            TData <List <MenuEntity> > objMenu = await menuBLL.GetList(null);

            List <MenuEntity> menuList = objMenu.Result;

            menuList = menuList.Where(p => p.MenuStatus == StatusEnum.Yes.ParseToInt()).ToList();

            if (operatorInfo.IsSystem != 1)
            {
                TData <List <MenuAuthorizeInfo> > objMenuAuthorize = await menuAuthorizeBLL.GetAuthorizeList(operatorInfo);

                List <long?> authorizeMenuIdList = objMenuAuthorize.Result.Select(p => p.MenuId).ToList();
                menuList = menuList.Where(p => authorizeMenuIdList.Contains(p.Id)).ToList();
            }

            ViewBag.MenuList     = menuList;
            ViewBag.OperatorInfo = operatorInfo;
            return(View());
        }