Beispiel #1
0
        public async Task <IActionResult> AssignPage()
        {
            string userName = HttpContext.User.Identity.Name;
            var    userId   = _db.Users.Where(x => x.UserName == userName).Select(x => x.Id).FirstOrDefault();
            //List<string> roleids = _db.UserRoles.Where(x => x.UserId == userId).Select(x => x.RoleId).ToList();
            //List<int?> lstmodule = _db.UserAccessPages.Where(x => roleids.Contains(x.applicationRoleId)).Select(x => x.navbarId).ToList();

            //List<int> lstparentId = _db.Navbars.Where(x => lstmodule.Contains(x.Id)).Select(x => x.parentID).ToList();
            //List<int> lstparentIdF = _db.Navbars.Where(x => lstparentId.Contains(x.Id)).Select(x => x.parentID).ToList();

            var navdata = await pageAssignService.GetNavbars(userName);

            //var adminrole = _db.UserRoles.Where(x => x.UserId == userId && x.RoleId == "1052c2d9-d87f-4004-873c-1db3ed353e4f").ToList();
            //if (adminrole.Count() == 0)
            //{
            //    navdata = navdata.Where(x => lstmodule.Contains(x.Id) || lstparentId.Contains(x.Id) || lstparentIdF.Contains(x.Id));
            //}
            //List<int?> modid = navdata.Select(x => x.moduleId).ToList();
            var modules = await moduleAssignService.GetLAFModules();

            //if (adminrole.Count() == 0)
            //{
            //    modules = modules.Where(x => modid.Contains(x.Id));
            //}
            NavbarViewModel model = new NavbarViewModel
            {
                navbars    = navdata, //await pageAssignService.GetNavbars(userName),
                ERPModules = modules  //await pageAssignService.GetERPModules()
            };

            ViewBag.UserTypeID = 1;

            return(PartialView("_Navbar", model));
        }
        // GET: Bank
        public async Task <IActionResult> Create()
        {
            var model = new NavbarViewModel
            {
                ERPModules      = await moduleAssignService.GetLAFModules(),
                navbarsbyparent = await navbarService.GetNavbarItemByParent(),
                navbars         = await navbarService.GetNavbarItem(),
            };

            return(View(model));
        }