public void DeleteImages(int profileId) { if (imageRepo.Images.Where(i => i.ProfileId == profileId).Count() == 0) { return; } List <Image> images = new List <Image>(); foreach (Image i in imageRepo.ByProfileId(profileId)) { // Remove fullsize and thumbnail images from file system. ApiImageController.DeleteFromFileSystem(i.Name, env.WebRootPath); images.Add(i); } foreach (Image i in images) { imageRepo.DeleteImage(i); } }
public int?ProfileImagesCount(int profileId) { int relationshipTier = friendRepo.RelationshipTier(currentProfile.profile.ProfileId, profileId); return(imageRepo.ByProfileId(profileId).Where(i => i.PrivacyLevel <= relationshipTier).Count()); }