public async Task <IActionResult> Delete(ApiResourceEditViewModel viewmodel) { var isRecordFound = _dbContext.ApiResources.Any(o => o.Id == viewmodel.Id); if (ModelState.IsValid && isRecordFound) { var record = _mapper.Map <ApiResource>(viewmodel); _dbContext.Remove(record); var result = await _dbContext.SaveChangesAsync(); if (result > 0) { return(RedirectToAction(nameof(Index))); } ModelState.AddModelError("", "Failed"); } return(View(viewmodel)); }
public async Task <IActionResult> Delete(ApiScopeClaimEditViewModel viewmodel) { var isRecordFound = _dbContext.ApiScopeClaims.Any(o => o.Id == viewmodel.Id); if (ModelState.IsValid && isRecordFound) { var record = _mapper.Map <ApiScopeClaim>(viewmodel); _dbContext.Remove(record); var result = await _dbContext.SaveChangesAsync(); if (result > 0) { return(RedirectToAction("Details", "ApiScopes", new { id = viewmodel.ScopeId })); } ModelState.AddModelError("", "Failed"); } return(View(viewmodel)); }
public async Task <IActionResult> Delete(ClientPostLogoutRedirectUriEditViewModel viewmodel) { var isRecordFound = _dbContext.ClientPostLogoutRedirectUris.Any(o => o.Id == viewmodel.Id); if (ModelState.IsValid && isRecordFound) { var record = _mapper.Map <ClientPostLogoutRedirectUri>(viewmodel); _dbContext.Remove(record); var result = await _dbContext.SaveChangesAsync(); if (result > 0) { return(RedirectToAction("Details", "Clients", new { id = viewmodel.ClientId })); } ModelState.AddModelError("", "Failed"); } return(View(viewmodel)); }