public async Task <IActionResult> Create(IdentityRole role) { if (ModelState.IsValid) { if (string.IsNullOrEmpty(role.Name)) { ModelState.AddModelError(string.Empty, "Role name is required"); return(View(role)); } if (await _userHelper.CheckRoleAsyn(role.Name)) // Existe o role { ModelState.AddModelError(string.Empty, "Already exists a role with that name"); return(View(role)); } await _userHelper.CreateRoleAsyn(role.Name); return(RedirectToAction(nameof(Index))); } return(View(role)); }