コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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());
        }
コード例 #6
0
        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());
        }
コード例 #7
0
        /// <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)])));
        }
コード例 #8
0
        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)])));
        }
コード例 #9
0
        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"));
        }
コード例 #10
0
 public IResult Delete(CarImages images)
 {
     _carImageDal.Delete(images);
     return(new SuccessResult(Messages.Deleted));
 }
コード例 #11
0
 public IResult Delete(CarImage carImages)
 {
     _carImagesDal.Delete(carImages);
     return(new SuccessResult("Araba resmi başarıyla silindi."));
 }
コード例 #12
0
 public IResult Delete(CarImage carImage)
 {
     FileHelper.Delete(carImage.ImagePath);
     _carImageDal.Delete(carImage);
     return(new SuccessResult());
 }
コード例 #13
0
 public IResult Delete(CarImages entity)
 {
     FileHelper.Delete(entity.ImagePath);
     _carImagesDal.Delete(entity);
     return new SuccessResult();
 }
コード例 #14
0
 public IResult Delete(CarImages carImages)
 {
     FileHelper.Delete(carImages.CarImagesPath);
     _carImageDal.Delete(carImages);
     return(new SuccessResult());
 }
コード例 #15
0
 public IResult DeleteCarImageById(int carImageId)
 {
     _carImagesDal.Delete(_carImagesDal.Get(ci => ci.CarImageId == carImageId));
     return(new SuccessResult(Messages.CarImageDeleted));
 }
コード例 #16
0
 public IResult Delete(CarImages carImages)
 {
     _carImagesDal.Delete(carImages);
     return(new SuccessResult("resim silindi"));
 }