コード例 #1
0
        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));
        }