Ejemplo n.º 1
0
        public async Task <IActionResult> AddDeveloperRoleUser(AddDeveloperRoleUserViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                viewModel.AssignableScopes = await GetOrganisationScopes();

                return(View(viewModel));
            }

            var organisationId   = new Guid(HttpContext.Session.GetString(_organisationId));
            var authorisedOrgIds = HttpContext.User.GetOrganisationIds();
            var newRoleUser      = viewModel.MapToRoleUserEntity();

            newRoleUser.OrganisationId = organisationId;
            var addResult = await _identityManagementRepository.AddRoleUserAsync(newRoleUser, authorisedOrgIds);

            if (addResult.IsError)
            {
                viewModel.AssignableScopes = await GetOrganisationScopes();

                ModelState.AddModelError(nameof(viewModel.Email), addResult.OperationError.Message);
                return(View(viewModel));
            }

            return(RedirectToAction(nameof(OrganisationRoleUsers), new { organisationId = organisationId }));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddDeveloperRoleUser()
        {
            var viewModel = new AddDeveloperRoleUserViewModel()
            {
                AssignableScopes = await GetOrganisationScopes()
            };

            return(View(viewModel));
        }