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)); }
public IActionResult Create(int identityResourceId) { var vm = new IdentityClaimViewModel { IdentityResourceId = identityResourceId }; return(View(vm)); }