public IResult Delete(Image image)
        {
            var result = _imageDal.Get(c => c.ImageId == image.ImageId);

            ImageFileHelper.Delete(result.ImagePath);
            _imageDal.Delete(image);
            return(new SuccessResult(Messages.ImageDeleted));
        }
 public bool Delete(Image model)
 {
     try
     {
         return(imageDal.Delete(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
        public IResult Delete(CarImages carImages)
        {
            IResult result = BusinessRules.Run(FindImagesForDelete(carImages.Id));

            if (result != null)
            {
                return(result);
            }
            _ımageDal.Delete(carImages);

            return(new SuccessResult(Messages.CarImageDeleted));
        }
        public IResult Delete(Image image)
        {
            var check = BusinessRules.Run(CheckTheCarExists(image.CarId));

            if (check != null)
            {
                return(check);
            }

            FormFileHelper.Delete(image.ImagePath);
            _imageDal.Delete(image);
            return(new SuccessResult(Messages.ImageDeleted));
        }
Beispiel #5
0
        public IResult Delete(ImageDto item)
        {
            var getResult = _imageDal.Get(i => i.Id == item.Id);

            _imageDal.Delete(new Image {
                Id = item.Id, CarId = item.CarId, ImagePath = item.ImagePath
            });

            var deleteResult = FileHelper.Delete(getResult.ImagePath);


            return(deleteResult);
        }
Beispiel #6
0
        public IResult Delete(CarImage carImage)
        {
            IResult result = BusinessRules.Run(CarImageDelete(carImage));

            if (result != null)
            {
                return(result);
            }

            _ımageDal.Delete(carImage);

            return(new SuccessResult());
        }
        public IResult Delete(Image image)
        {
            IResult result = BusinessRules.Run(ImageDelete(image));

            if (result != null)
            {
                return(result);
            }
            var oldPath = _imageDal.Get(c => c.Id == image.Id).ImagePath;

            FileHelper.Delete(oldPath);
            _imageDal.Delete(image);

            return(new SuccessResult());
        }
        public IResult Delete(CarImage carImage)
        {
            //if (carImage.ImagePath.Contains("default.jpg"))
            //{
            //    _imageDal.Delete(carImage);
            //}
            //else
            //{
            //    FileHelper.DeleteFile(carImage.ImagePath);
            //    _imageDal.Delete(carImage);
            //}
            FileHelper.DeleteFile(carImage.ImagePath);
            _imageDal.Delete(carImage);

            return(new SuccessResult());
        }
Beispiel #9
0
        public IResult Delete(Image image)
        {
            var oldpath = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..\\..\\..\\Root")) +
                          _imageDal.Get(p => p.Id == image.Id).ImagePath;

            IResult result = BusinessRules.Run(
                FileHelper.DeleteAsync(oldpath));

            if (result != null)
            {
                return(result);
            }

            _imageDal.Delete(image);
            return(new SuccessResult(Messages.ImageDeleted));
        }
 public IResult Delete(Image image)
 {
     _imageDal.Delete(image);
     return(new SuccessResult());
 }
Beispiel #11
0
 public void Delete(Image image)
 {
     _imageDal.Delete(image);
 }
Beispiel #12
0
 public IResult Delete(CarImage carImage)
 {
     FileHelper.Delete(carImage.ImagePath);
     _imageDal.Delete(carImage);
     return(new SuccessResult());
 }
Beispiel #13
0
 public IResult Delete(Image image)
 {
     FileHelper.Delete(image.ImagePath);
     _imageDal.Delete(image);
     return(new SuccessResult(Messages.ImageDeleted));
 }