コード例 #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());
        }