public async Task <IActionResult> AddUser(RegisterViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var result = await _userManagerService.AddUserTask(model); if (result.Succeeded) { return(RedirectToAction("Index")); } foreach (var error in result.Errors) { ModelState.AddModelError("", error.Description); } return(View(model)); }