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);
        }
예제 #2
0
        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);
        }
예제 #4
0
 public IActionResult Delete(int id)
 {
     _userProfileRepository.Delete(id);
     return(NoContent());
 }
예제 #5
0
 public IActionResult Delete(int id)
 {
     _userRepo.Delete(id);
     return(NoContent());
 }
예제 #6
0
 public void DeleteAccount(int id)
 {
     UserProfileRepository.Delete(id);
 }
예제 #7
0
 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)));
 }
예제 #9
0
 public IActionResult Delete(string id)
 {
     _profileRepository.Delete(id);
     return(NoContent());
 }
예제 #10
0
 public IActionResult Delete(string firebaseId)
 {
     _userProfileRepo.Delete(firebaseId);
     return(NoContent());
 }