public async Task <ActionResult> DeleteUser(string userId)
        {
            bool result       = false;
            var  _userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var  user         = await _userManager.FindByIdAsync(userId);

            var rolesForUser = await _userManager.GetRolesAsync(userId);

            if (user != null)
            {
                result = await _deleteUser.Delete(userId);

                if (result)
                {
                    if (rolesForUser != null && rolesForUser.Count() > 0)
                    {
                        foreach (var item in rolesForUser.ToList())
                        {
                            // item should be the name of the role
                            await _userManager.RemoveFromRoleAsync(user.Id, item);
                        }
                    }
                    await _userManager.DeleteAsync(user);
                }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public void Delete_User_Invalid()
        {
            User user = null;

            mockRepository.FindOneAsync(Arg.Any <Expression <Func <User, bool> > >()).Returns(user);

            var notification = new Notification("");

            mockNotifier.Handle(notification);
            var erros = mockNotifier.GetNotifications();

            mockNotifier.HasNotification().Returns(true);

            appService.Delete(Email_Invalido);

            Assert.True(mockNotifier.HasNotification());
        }
        public void DeleteUser(int?id)
        {
            if (id == null)
            {
                throw new InvalidInputException(_path, "Delete()");
            }

            _deleteUser.Delete(id);
        }
        public async Task <IActionResult> DeleteEmail(string email)
        {
            await delete.Delete(email);

            return(CustomResponse());
        }