Esempio n. 1
0
        public IActionResult Permissions(int id, List <SelectableViewModel <PermissionViewModel> > selectablePermissions)
        {
            var permissionsIds = GetSelectedItems(selectablePermissions).Select(x => x.Id);

            var result = m_rolesManager.AssignPermissionsToRole(id, permissionsIds);

            if (result.HasError)
            {
                ModelState.AddModelError(result.Error.Message);

                var viewModel = ViewModelBuilder.BuildPermissionsViewModel(ModelState, id);

                return(View(viewModel));
            }

            return(RedirectToAction(nameof(View), new { id }));
        }
Esempio n. 2
0
        public IActionResult Permissions(int id)
        {
            var viewModel = ViewModelBuilder.BuildPermissionsViewModel(ModelState, id);

            return(View(viewModel));
        }