コード例 #1
0
        public async Task <IActionResult> Create([Bind("ID,Name,Slug,Permissioins")] RoleViewModel roleViewModel)
        {
            Role role = roleViewModel.GetEntity();

            if (ModelState.IsValid)
            {
                _context.Add(role);

                _rbac.AddRolePermissions(role.ID, roleViewModel.Permissions);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(role));
        }