예제 #1
0
 public IResult Update(CarImage image, IFormFile file)
 {
     FileProcess.Delete(_carImageDal.Get(i => i.Id == image.Id).ImagePath);
     image.ImagePath = FileProcess.Create(file, Paths.ImagesPath);
     image.Date      = DateTime.Now;
     _carImageDal.Update(image);
     return(new SuccessResult());
 }
예제 #2
0
        public IResult Add(CarImage image, IFormFile file)
        {
            var result = BusinessRules.Run(CheckIfImageCountOfCarExceeded(image.CarId));

            if (result != null)
            {
                return(result);
            }
            var path = FileProcess.Create(file, Paths.ImagesPath);

            image.ImagePath = path;
            image.Date      = DateTime.Now;
            _carImageDal.Add(image);
            return(new SuccessResult());
        }
예제 #3
0
 public IResult Delete(CarImage image)
 {
     FileProcess.Delete(_carImageDal.Get(i => i.Id == image.Id).ImagePath);
     _carImageDal.Delete(image);
     return(new SuccessResult());
 }