コード例 #1
0
        public IActionResult Add([FromForm] AddCarImageDto carIamgeDto)
        {
            var result = _carImageService.Add(carIamgeDto);

            if (result.Success)
            {
                return(Ok(result.Message));
            }
            return(BadRequest(result.Message));
        }
コード例 #2
0
        public IResult Add(AddCarImageDto carImageDto)
        {
            IResult result = BusinessRules.Run(CheckImageCount(carImageDto.CarId));

            if (result != null)
            {
                return(result);
            }
            else
            {
                var imagePath = UploadImage(carImageDto.File);
                if (imagePath.Success)
                {
                    CarImage carImage = new CarImage
                    {
                        ImagePath = imagePath.Data,
                        CarId     = carImageDto.CarId
                    };
                    _carImageDal.Add(carImage);
                    return(new SuccessResult(Messages.AddCarImage));
                }
            }
            return(new ErrorResult(Messages.PictureLimitExceeded));
        }