public async Task <bool> Exists(ImageFileIdentity imageFileIdentity) { var fileIdentity = imageFileIdentity.GetFileIdentity(); var exists = await this.LocalFileInfoRepository.Exists(fileIdentity); return(exists); }
public async Task <FileFormat> GetImageFileFormat(ImageFileIdentity imageFileIdentity) { var fileIdentity = imageFileIdentity.GetFileIdentity(); var fileFormat = await this.LocalFileInfoRepository.GetFileFormat(fileIdentity); return(fileFormat); }
public async Task Delete(ImageFileIdentity imageFileIdentity) { var uniqueImageFileName = imageFileIdentity.GetUniqueFileName(); var uniqueImageFilePath = this.GetUniqueImageFilePath(uniqueImageFileName); // The multiple tasks are sequentially awaited to allow failures to preserve the sequence of events in case of failure. // (The alternative would have been to Task.WhenAll() the various tasks, which would be simultaneous, but would lead to situations where things might get out of whack in case of failure.) // Delete the image file. await FileHelper.DeleteAsync(uniqueImageFilePath.Value); // Remove the local file info. var fileIdentity = imageFileIdentity.GetFileIdentity(); await this.LocalFileInfoRepository.Delete(fileIdentity); // Delete the original image name mapping. await this.OriginalFileNameMappingRepository.Delete(uniqueImageFileName); }