public IResult Delete(CarImage entity) { var imageData = _carImageDal.Get(p => p.CarId == entity.CarId); File.Delete(@"wwwroot\images\" + imageData.ImagePath); _carImageDal.Delete(imageData); return(new SuccessResult(Messages.CarImageDeleted)); }
public IResult Delete(CarImages entity) { var imageData = _carImageDal.Get(p => p.Id == entity.Id); FileProcessHelper.Delete(imageData.ImagePath); _carImageDal.Delete(imageData); return(new SuccessResult(Messages.DeleteCarImageMessage)); }
public IResult Delete(CarImage carImage) { var image = _carImagesDal.Get(c => c.CarImageId == carImage.CarImageId); if (image == null) { return(new ErrorResult("Image not found")); } FileHelper.Delete(image.ImagePath); _carImagesDal.Delete(carImage); return(new SuccessResult("Image was deleted successfully")); }
public IResult Delete(CarImages carImage) { var image = _carImageDal.Get(c => c.Id == carImage.Id); if (image == null) { return(new ErrorResult(Messages.NotFoundImage)); } FileHelper.Delete(image.ImagePath); _carImageDal.Delete(carImage); return(new SuccessResult(Messages.DeletedImage)); }
public IResult Delete(CarImages carImages) { var oldpath = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..\\..\\..\\wwwroot")) + _carImagesDal.GetById(p => p.Id == carImages.Id).ImagePath; IResult result = BusinessRules.Run( FileHelper.DeleteAsync(oldpath)); if (result != null) { return(result); } _carImagesDal.Delete(carImages); return(new SuccessResult()); }
public IResult Delete(CarImages carImages) { IResult result = BusinessRules.Run( CheckIfImageExists(carImages.Id) ); if (result != null) { return(result); } string path = GetById(carImages.Id).Data.ImagePath; FileHelper.Delete(path); _carImageDal.Delete(carImages); return(new SuccessResult()); }
/// <summary> /// All Car data will be removed when the car delete /// </summary> /// <param name="id">Car Id</param> /// <returns></returns> public IResult Delete(int id) { var DeletedCar = GetById(id).Data; cardal.Delete(DeletedCar); var DeletedCarImages = carImagesDal.GetAll(pre => pre.CarId == DeletedCar.Id); foreach (var deletedCarImage in DeletedCarImages) { carImagesDal.Delete(deletedCarImage); if (!deletedCarImage.ImagePath.Equals("thumbnail.png")) { fileProcess.Delete(deletedCarImage.ImagePath); } } return(new SuccessResult(Messages.Delete_Message(Messages.GetNameDict[typeof(Car)]))); }
public IResult Delete(int id) { IResult result = BusinessRules.Run(CheckTheCarImageExists(FileId: id), CheckTheCarExists(id)); if (result != null) { return(null); } CarImage currentCar = GetById(id).Data; carImagesDal.Delete(currentCar); if (!currentCar.ImagePath.Equals("thumbnail.png")) // Delete it if current car's image is not thumbnail. { fileProcess.Delete(currentCar.ImagePath); } return(new SuccessResult(Messages.Add_Message(Messages.GetNameDict[typeof(CarImage)]))); }
private IResult DeleteMetod(CarImages carImage) { var images = _carImageDal.Get(c => c.Id == carImage.Id); if (images == null) { return(new ErrorResult("Image not found")); } var path = "wwwroot" + images.ImagePath; if (File.Exists(path.Replace("/", "\\"))) { File.Delete(path.Replace("/", "\\")); } _carImageDal.Delete(carImage); return(new SuccessResult("Image was deleted successfully")); }
public IResult Delete(CarImages images) { _carImageDal.Delete(images); return(new SuccessResult(Messages.Deleted)); }
public IResult Delete(CarImage carImages) { _carImagesDal.Delete(carImages); return(new SuccessResult("Araba resmi başarıyla silindi.")); }
public IResult Delete(CarImage carImage) { FileHelper.Delete(carImage.ImagePath); _carImageDal.Delete(carImage); return(new SuccessResult()); }
public IResult Delete(CarImages entity) { FileHelper.Delete(entity.ImagePath); _carImagesDal.Delete(entity); return new SuccessResult(); }
public IResult Delete(CarImages carImages) { FileHelper.Delete(carImages.CarImagesPath); _carImageDal.Delete(carImages); return(new SuccessResult()); }
public IResult DeleteCarImageById(int carImageId) { _carImagesDal.Delete(_carImagesDal.Get(ci => ci.CarImageId == carImageId)); return(new SuccessResult(Messages.CarImageDeleted)); }
public IResult Delete(CarImages carImages) { _carImagesDal.Delete(carImages); return(new SuccessResult("resim silindi")); }