Ejemplo n.º 1
0
        public async Task <IActionResult> Delete(String id)
        {
            ApplicationUser user = await userAccountPresentationService.FindById(id);

            if (user != null)
            {
                // Remove all todos user
                todoPresintationService.RemoveAll(id).Wait();

                // Delete user
                IdentityResult deleteUser = await userAccountPresentationService.Delete(user);

                if (deleteUser.Succeeded)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    AddErrorsFromResult(deleteUser);
                }
            }
            else
            {
                ModelState.AddModelError("", "User Not Found");
            }

            return(View("Index", userAccountPresentationService.Users));
        }