public IResult Delete(CarImage carImage)
        {
            string path = GetById(carImage.Id).Data.ImagePath;

            CarImagesFileHelper.Delete(path);
            _carImageDal.Delete(carImage);
            return(new SuccessResult());
        }
Пример #2
0
        public IResult Delete(CarImage carImage)
        {
            IResult result = BusinessRules.Run(CheckIfImageExists(carImage.ImageId));

            if (result != null)
            {
                return(result);
            }
            string path = GetById(carImage.ImageId).Data.ImagePath;

            CarImagesFileHelper.Delete(path);
            return(new SuccessResult());
        }
Пример #3
0
        public IResult Delete(int carImageId)
        {
            var     getCarImage = DatabaseCarImageCheck(carImageId);
            IResult result      = BusinessRules.Run(getCarImage);

            if (result != null)
            {
                return(result);
            }
            var delete = CarImagesFileHelper.Delete(getCarImage.Data.ImagePath);

            if (delete.Success)
            {
                _carImageDal.Delete(getCarImage.Data);
                return(new SuccessResult(Messages.CarImageDeleted));
            }
            return(new ErrorResult(Messages.CarImageNotDeleted));
        }
Пример #4
0
 public IResult Delete(CarImage carImage)
 {
     CarImagesFileHelper.Delete(carImage.ImagePath);
     _carImageDal.Delete(carImage);
     return(new SuccessResult());
 }