public async Task <IActionResult> DeleteConfirmed(string id)
        {
            await applicationUserRepository.Delete(id);

            TempData["StatusMessage"] = "Account has been deleted successfully.";
            return(RedirectToAction(nameof(Index)));
        }
Beispiel #2
0
        public ValidationResult Delete(object id)
        {
            AppUserValidator validator = new AppUserValidator();
            var entity = repo.FindById(id);
            ValidationResult result = validator.Validate(entity);

            if (result.IsValid)
            {
                repo.Delete(id);
                repo.Save();
            }
            return(result);
        }
        public ActionResult Delete(IList <Admin> rows)
        {
            var adminRepo = new ApplicationUserRepository <Admin>();
            var roleRepo  = new ApplicationRoleRepository();

            foreach (var row in rows)
            {
                row.Role = roleRepo.GetByName("admin");
                adminRepo.Delete(row);
            }

            TempData["success"] = "User/s was deleted!";

            return(View("Admins"));
        }