public async Task <IActionResult> Edit(int id, [Bind("RoleName,MenuGuid,Pid,Guid,PGuid,Id,CreateTime,IsDelete,Description,TimestampV")] AdmRole admRole)
        {
            if (id != admRole.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(admRole);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdmRoleExists(admRole.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(admRole));
        }
 public void GetRootNodesRole(List <AdmRole> admJurisdictionList, AdmRole admJurisdiction)
 {
     try
     {
         if (admJurisdictionList.Count > 0)
         {
             if (admJurisdictionList.Count > 0)
             {
                 var menu = admJurisdictionList.FirstOrDefault(u => u.Guid == admJurisdiction.PGuid);
                 if (menu != null && menu.Id > 0)
                 {
                     GetRootNodesRole(admJurisdictionList, menu);
                 }
                 else
                 {
                     if (!RootMenuGuidListRole.Contains(admJurisdiction.Guid))
                     {
                         RootMenuGuidListRole.Add(admJurisdiction.Guid);
                         RootMenuListRole.Add(admJurisdiction);
                     }
                 }
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
        public async Task <IActionResult> Create([Bind("RoleName,MenuGuid,Pid,Guid,PGuid,Id,CreateTime,IsDelete,Description,TimestampV")] AdmRole admRole)
        {
            if (ModelState.IsValid)
            {
                admRole.CreateTime = DateTime.Now;
                admRole.Guid       = Guid.NewGuid().ToString().ToUpper();
                _context.Add(admRole);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admRole));
        }
 public AdmRole CreateNodeTreeRole(List <AdmRole> admJurisdictionList, AdmRole RootAdmJurisdiction)
 {
     if (admJurisdictionList.Count > 0)
     {
         List <AdmRole> listm = admJurisdictionList.Where(u => u.PGuid == RootAdmJurisdiction.Guid).ToList();
         if (listm != null && listm.Count > 0)
         {
             RootAdmJurisdiction.Children = listm;
             listm.ForEach(m =>
             {
                 CreateNodeTreeRole(admJurisdictionList, m);
             });
         }
     }
     return(RootAdmJurisdiction);
 }