public async Task<ActionResult> Create(CreateRoleViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.Controllers = GetControllers();
                return View(viewModel);
            }

            var role = new ApplicationRole
            {
                Name = viewModel.Name,
                RoleAccesses = new List<RoleAccess>()
            };

            //
            foreach (var controller in viewModel.SelectedControllers)
            {
                foreach (var action in controller.Actions)
                {
                    role.RoleAccesses.Add(new RoleAccess { Controller = controller.Name, Action = action.Name });
                }
            }

            await RoleManager.CreateAsync(role);
            return RedirectToAction("Index");
        }
 public ActionResult Create()
 {
     var createRoleViewModel = new CreateRoleViewModel
     {
         Controllers = GetControllers()
     };
     return View(createRoleViewModel);
 }