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)); }
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)); }
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()); }
//[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()); }
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)); }
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)); }
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)); }
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()); }
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()); }
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)); }
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()); }
public IResult Add(IFormFile file, Image image) { _imageDal.Add(image); return(new SuccessResult()); }
public void Add(Image image) { _imageDal.Add(image); }
public IResult Add(CarImage carImage) { BusinessRules.Run(CheckCarImagesCount(carImage.CarId)); _imageDal.Add(carImage); return(new SuccessResult(Messages.ImageAdded)); }