public IActionResult Delete(CarImage carImage) { var isDeleted = _fileHelper.DeleteFile(carImage.ImagePath); if (isDeleted.Result.Success) { var result = _carImageService.Delete(carImage); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); } return(BadRequest(isDeleted.Result)); }
public IHttpActionResult Delete(string id) { var fileId = Guid.Parse(id); var result = FileHelper.DeleteFile(fileId); return(Ok(result)); }
public IActionResult Delete(int id) { _fileHelper.DeleteFile(id); return(Accepted()); }
private void DeletedFile(CarImage carImage) { var image = _carImageDal.Get(c => c.Id == carImage.Id); _fileHelper.DeleteFile(image.ImagePath); }
public double MeasureSimilarity(List <Trajectory> a, List <Trajectory> b) { string directoryPath = _fileHelper.GetCurrentDirectory(); StringBuilder contentA = new StringBuilder(); string fileNameA = "FileA"; string filePathA = directoryPath + @"\" + fileNameA + ".txt"; string zipPathA = directoryPath + @"\" + fileNameA + ".zip"; foreach (var item in a) { contentA.AppendLine(item.Instance.ToString()); } _fileHelper.WriteToTextFile(contentA.ToString(), filePathA); _fileHelper.CompressFile(filePathA, zipPathA); long sizeA = _fileHelper.GetFileSize(zipPathA); StringBuilder contentB = new StringBuilder(); string fileNameB = "FileB"; string filePathB = directoryPath + @"\" + fileNameB + ".txt"; string zipPathB = directoryPath + @"\" + fileNameB + ".zip"; foreach (var item in b) { contentB.AppendLine(item.Instance.ToString()); } _fileHelper.WriteToTextFile(contentB.ToString(), filePathB); _fileHelper.CompressFile(filePathB, zipPathB); long sizeB = _fileHelper.GetFileSize(zipPathB); List <Trajectory> combinedList = a.Concat(b).ToList(); StringBuilder contentAB = new StringBuilder(); string fileNameAB = "FileAB"; string filePathAB = directoryPath + @"\" + fileNameAB + ".txt"; string zipPathAB = directoryPath + @"\" + fileNameAB + ".zip"; foreach (var item in combinedList) { contentAB.AppendLine(item.Instance.ToString()); } _fileHelper.WriteToTextFile(contentAB.ToString(), filePathAB); _fileHelper.CompressFile(filePathAB, zipPathAB); long sizeAB = _fileHelper.GetFileSize(zipPathAB); double similarityMeasureScore = (double)sizeAB / (double)(sizeA + sizeB); // Delete the files after calculating the measure _fileHelper.DeleteFile(filePathA); _fileHelper.DeleteFile(filePathB); _fileHelper.DeleteFile(filePathAB); _fileHelper.DeleteFile(zipPathA); _fileHelper.DeleteFile(zipPathB); _fileHelper.DeleteFile(zipPathAB); return(similarityMeasureScore); }
public bool DeleteImage(string path) { return(_fileHelper.DeleteFile(path)); }
private void RemovePolicyFile() { const string policyFile = "C:\\Windows\\System32\\GroupPolicy\\Machine\\Registry.pol"; _fileHelper.DeleteFile(policyFile); }