public async Task<ActionResult> EditRole(EditRoleViewModel model) { if (ModelState.IsValid) { var identityManager = new IdentityManager(); if (model.Id != null) { var role = await identityManager.GetRoleByNameAsync(model.RoleName); await identityManager.UpdateRoleAsync(role); } else { await identityManager.CreateRoleAsync(model.RoleName); } await this.ApplicationDbContext.SaveChangesAsync(); return RedirectToAction("Index"); } return View(model); }