コード例 #1
0
        public IActionResult Create()
        {
            if (!RoleIs(Role.Administrator))
            {
                return(Forbid());
            }


            var form = new CreateUserForm
            {
                Entrances   = GetEntranceItems(_entranceService.AllActive()),
                Departments = GetDepartmentItems(_departmentService.AllActive())
            };

            SetRoles(form);

            return(View(form));
        }
コード例 #2
0
        public IActionResult List()
        {
            if (!RoleIs(Role.Administrator, Role.Manager, Role.SecurityGuard))
            {
                return(Forbid());
            }


            var entrances = _entranceService.AllActive();

            var entrancesViewModels = _mapper.Map <IEnumerable <EntranceViewModel> >(entrances);

            return(View(entrancesViewModels));
        }