public void DeleteProfile(long profileId, bool force = false) { var profile = _profileRepository.SingleAttached(p => p.Id == profileId); if (profile == null) { return; } var userId = profile.UserId; ExecuteDeleteProfile(profile, force); if (userId <= 0) { return; } var user = _userRepository.SingleAttached(p => p.Id == userId); if (user == null) { return; } user.Gender = 0; user.Guid = Guid.Empty; _userRepository.FullUpdate(user); }
public void MakeProfilePhoto(long profileId, Guid photoGuid) { var profile = _profileRepository.SingleAttached(p => p.Id == profileId, p => p.Photos); if (profile == null) { return; } if (!profile.Photos.Any(photo => photo.Guid == photoGuid)) { throw new HttpException(404, "Photo not found!"); } profile.ProfilePhotoGuid = photoGuid; _profileRepository.FullUpdate(profile); _profileService.UpdateRavenProfile(profile.Id); }