コード例 #1
0
 public IResult Update(IFormFile file, CarImage carImage)
 {
     carImage.ImagePath = ImageFileHelper.Update(_carImageDal.Get(p => p.Id == carImage.Id).ImagePath, file);
     carImage.Date      = DateTime.Now;
     _carImageDal.Update(carImage);
     return(new SuccessResult());
 }
コード例 #2
0
        public IResult Update(CarImage carImage, IFormFile formFile)
        {
            var uimage = (_carImageDal.Get(i => i.Id == carImage.Id).ImagePath);

            carImage.ImagePath = ImageFileHelper.Update(uimage, formFile);
            carImage.Date      = DateTime.Now;
            _carImageDal.Update(carImage);
            return(new SuccessResult(Messages.ImageUpdated));
        }
コード例 #3
0
        public IResult Update(IFormFile file, Image image)
        {
            IResult result = BusinessRules.Run(CheckIfImageLimitBorder(image.CarId));

            if (result != null)
            {
                return(result);
            }
            var result1 = _imageDal.Get(c => c.ImageId == image.ImageId);

            image.ImagePath = ImageFileHelper.Update(file, result1.ImagePath);
            image.Date      = DateTime.Now;
            _imageDal.Update(image);
            return(new SuccessResult(Messages.ImageUpdated));
        }
コード例 #4
0
        public IResult Update(CarImage carImage, IFormFile file)
        {
            IResult result = BusinessRules.Run(
                CheckIfImageLimitExpired(carImage.CarId),
                CheckIfImageExtensionValid(file),
                CheckIfImageExists(carImage.Id)
                );

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

            CarImage OldData = GetById(carImage.Id).Data;

            carImage.ImagePath = ImageFileHelper.Update(file, OldData.ImagePath);
            carImage.Date      = DateTime.Now;
            carImage.CarId     = OldData.CarId;
            _carImageDal.Update(carImage);
            return(new SuccessResult());
        }