public static void DeleteOneUserProfile(int userProfileID) { var profile = new UserProfileRepository().GetById(userProfileID); // Delete all associated Messages var mRep = new MessageRepository(); var messages = mRep.All().Where(m => m.UserID == profile.UserID).ToList(); foreach (var m in messages) mRep.Delete(mRep.GetById(m.MessageID)); mRep.SaveChanges(); // Delete all associated Images var iRep = new ImageRepository(); var images = iRep.All().Where(i => i.UserID == profile.UserID).ToList(); foreach (var i in images) iRep.Delete(i.ImageID); iRep.SaveChanges(); // Delete all associated UserFriends var ufRep = new UserFriendRepository(); var userFriends = ufRep.All().Where(u => u.UserID == profile.UserID).ToList(); foreach (var u in userFriends) ufRep.Delete(u.UserFriendID); ufRep.SaveChanges(); var upRep = new UserProfileRepository(); upRep.Delete(upRep.GetById(profile.UserID)); upRep.SaveChanges(); // Finally delete user from Membership Membership.DeleteUser(Membership.GetUser(profile.aspUserID).UserName, true); }
public ActionResult DeleteUser(int id) { _uRep.Delete(_uRep.Find(id)); _upRep.Delete(_upRep.Find(id)); return(RedirectToAction("UserList", "User", new { Area = "Panel" })); }
public void Delete(int id) { var repository = new UserProfileRepository(_dbContext, _cache.Object, _logger.Object); repository.Delete(id); var testedItem = _dbContext.UserProfiles.Find(id); Assert.Null(testedItem); }
public IActionResult Delete(int id) { _userProfileRepository.Delete(id); return(NoContent()); }
public IActionResult Delete(int id) { _userRepo.Delete(id); return(NoContent()); }
public void DeleteAccount(int id) { UserProfileRepository.Delete(id); }
public ActionResult <UserProfileDto> Delete(int profileId) { return(Ok(_repository.Delete(profileId))); }
public async Task <ActionResult <UserProfileDto> > Delete(int profileId) { return(Ok(await _repository.Delete(profileId))); }
public IActionResult Delete(string id) { _profileRepository.Delete(id); return(NoContent()); }
public IActionResult Delete(string firebaseId) { _userProfileRepo.Delete(firebaseId); return(NoContent()); }