public IActionResult PermisionList(string roleId) { var controllerExcepts = _configuration.GetValue <string>("Permisions:ExceptsController")?.Split(",").ToList(); var Namespace = _configuration.GetValue <string>("Permisions:NamespaceCustomer"); Assembly asm = Assembly.GetExecutingAssembly(); var controllerList = asm.GetTypes().Where(type => typeof(Controller).IsAssignableFrom(type) && (string.IsNullOrWhiteSpace(Namespace) || type.Namespace.Contains(Namespace)) && !controllerExcepts.Contains(type.Name) && !type.IsNotPublic) .Select(x => new ControllerModel() { ActionList = x.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public) .Select(y => y.Name).Distinct().Select(z => new ActionModel { Name = z }).ToList(), Name = x.Name }).ToList(); var model = new PermisionViewModel() { RoleId = roleId, RoleList = Enum.GetValues(typeof(PermisionEnum)).Cast <PermisionEnum>() .Select(y => new SelectionModel() { Value = ((int)y).ToString(), Name = y.GetDescription() }) .OrderBy(r => r.Value).ToList(), ControllerList = controllerList, RoleGroups = _roleService.GetRoleGroups(roleId)?.Select(x => new RoleGroupViewModel() { ActionName = x.ActionName, ControllerName = x.ControllerName, Id = x.Id, PermisionEnumId = x.Type }).ToList(), }; var render = _viewEngineService.RenderPartialToStringAsync("~/Areas/Admin/Views/Permision/_PermisionListPartial.cshtml", model); return(Json(new { status = true, html = render.Result })); }