コード例 #1
0
 public IResult Add(Image image)
 {
     //IResult result = BusinessRules.Run(CheckIfImageCountMoreThanFive(image.CarId));
     //if (result != null)
     //{
     //    return result;
     //}
     _imageDal.Add(image);
     return(new SuccessResult(Messages.ImageAdded));
 }
コード例 #2
0
        public IResult Add(Car car)
        {
            //bussiness kodları buraya yazılır
            _iCarDal.Add(car);
            Image image = new Image {
                CarId = car.CarId, ImagePath = car.Thumbnail, LoadDate = DateTime.Now
            };

            _imageDal.Add(image);


            return(new SuccessResult(Messages.CarAdded));
        }
コード例 #3
0
        public IResult Add(CarImage carImage, IFormFile formFile)
        {
            //var result = CheckImageLimit(carImage.CarId);
            //if (!result.Success)
            //{
            //    return result;
            //}

            var result = BusinessRules.Run(CheckImageLimit(carImage.CarId));

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

            if (formFile != null)
            {
                var filePath = FileHelper.AddFile(formFile);
                if (filePath.Success)
                {
                    _imageDal.Add(new CarImage
                    {
                        CarId     = carImage.CarId,
                        ImagePath = filePath.Data
                    });
                    return(new SuccessResult());
                }
            }
            else
            {
                _imageDal.Add(new CarImage
                {
                    CarId     = carImage.CarId,
                    ImagePath = SetDefaultImage()
                });
                return(new SuccessResult());
            }
            return(new ErrorResult());
        }
コード例 #4
0
        //[ValidationAspect(typeof(ImageValidator))]
        public IResult Add(IFormFile file, CarImage carImage)
        {
            IResult result = BusinessRules.Run(CheckIfImageLimit(carImage.CarId));

            if (result != null)
            {
                return(result);
            }
            carImage.ImagePath = FileHelper.Add(file);
            carImage.Date      = DateTime.Now;
            _ımageDal.Add(carImage);
            return(new SuccessResult());
        }
コード例 #5
0
        public IResult Add(IFormFile file, Image image)
        {
            var result = BusinessRules.Run(CheckCarImageLimitExeeded(image.CarId));

            if (result != null)
            {
                return(result);
            }
            image.ImagePath = FileHelper.Add(file);
            image.Date      = DateTime.Now;
            _imageDal.Add(image);
            return(new SuccessResult(Messages.ImageAdded));
        }
コード例 #6
0
        public IResult Add(Image image, IFormFile file)
        {
            IResult result = BusinessRules.Run(CheckIfImageLimitBorder(image.CarId), CheckIfImageExtensionValid(file));

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

            image.ImagePath = ImageFileHelper.Add(file);
            image.Date      = DateTime.Now;
            _imageDal.Add(image);
            return(new SuccessResult(Messages.ImageAdded));
        }
コード例 #7
0
        public IResult Add(IFormFile file, Image image)
        {
            var check = BusinessRules.Run(CheckImageLimit(image.CarId), CheckTheCarExists(image.CarId));

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

            image.ImagePath = FormFileHelper.Add(file);
            image.Date      = DateTime.Now;
            _imageDal.Add(image);
            return(new SuccessResult(Messages.ImageAdded));
        }
コード例 #8
0
        public IResult Add(IFormFile file, Image image)
        {
            var result = BusinessRules.Run(CheckIfImageLimit(image.VehicleId));

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

            image.ImagePath = FileHelper.Add(file);
            image.Date      = DateTime.Now;
            _imageDal.Add(image);

            return(new SuccessResult());
        }
コード例 #9
0
        public IResult Add(Image image, IFormFile file)
        {
            var result = BusinessRule.Run(CheckImageOfCarLimit(image.CarId));;

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



            image.ImagePath = FileHelper.newPath(file);
            image.Date      = DateTime.Now;


            _imageDal.Add(image);
            return(new SuccessResult());
        }
コード例 #10
0
ファイル: ImageManager.cs プロジェクト: ernkny/ReCap-RentCar
        public IResult Add(CarImages carImages, IFormFile file)
        {
            IResult result = BusinessRules.Run(TotalPictureControl(carImages.CarId), FileUploadControl(file));

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

            CarImages car = new CarImages
            {
                CarId     = carImages.CarId,
                Date      = DateTime.UtcNow,
                ImagePath = pathway
            };

            _ımageDal.Add(car);
            return(new SuccessResult(Messages.CarImageAdded));
        }
コード例 #11
0
        public IResult Add(ImageDto item)
        {
            foreach (var file in item.Files)
            {
                if (BusinessRules.Run(CheckImageLimitExceeded(item.CarId)) != null)
                {
                    return(new ErrorResult());
                }

                var result = FileHelper.add(file);
                if (!result.Success)
                {
                    return(result);
                }
                _imageDal.Add(new Image {
                    CarId = item.CarId, ImagePath = result.Message, DateTime = DateTime.Now
                });
            }

            return(new SuccessResult());
        }
コード例 #12
0
 public IResult Add(IFormFile file, Image image)
 {
     _imageDal.Add(image);
     return(new SuccessResult());
 }
コード例 #13
0
 public void Add(Image image)
 {
     _imageDal.Add(image);
 }
コード例 #14
0
 public IResult Add(CarImage carImage)
 {
     BusinessRules.Run(CheckCarImagesCount(carImage.CarId));
     _imageDal.Add(carImage);
     return(new SuccessResult(Messages.ImageAdded));
 }