Пример #1
0
        public async Task <IActionResult> Edit(IdentityClaimViewModel vm)
        {
            if (vm == null)
            {
                return(BadRequest());
            }

            if (ModelState.IsValid)
            {
                var obj = await _dbContext.Set <IdentityClaim>().FindAsync(vm.Id);

                if (obj == null)
                {
                    return(NotFound());
                }

                obj.Type = vm.Type;
                try
                {
                    await _dbContext.SaveChangesAsync();

                    _logger.LogInformation($"Identity claim Id {obj.Id} updated by {User?.Identity?.Name}.");
                    return(RedirectToAction("Edit", "IdentityResources", new { id = vm.IdentityResourceId }));
                }
                catch (DbException ex)
                {
                    _logger.LogError(ex.GetBaseException()?.Message ?? ex.Message);
                    throw;
                }
            }
            return(View(vm));
        }
Пример #2
0
        public IActionResult Create(int identityResourceId)
        {
            var vm = new IdentityClaimViewModel {
                IdentityResourceId = identityResourceId
            };

            return(View(vm));
        }