public async Task <IActionResult> Register(User user) { if (ModelState.IsValid) { user.Role = new Role { Id = 2, Name = "Manager" }; var result = _accountAgent.AddUser(user); if (result.Success) { return(await Task.FromResult(RedirectToAction("Login", "Account"))); } } return(await Task.FromResult(View())); }