示例#1
0
        public IActionResult GetByCarId(int carId)
        {
            var result = _entityService.GetByWithCarId(carId);


            if (result.Success)
            {
                //var pathToSave = Path.Combine(Directory.GetCurrentDirectory());
                foreach (var image in result.Data)
                {
                    image.ImagePath = Path.Combine(Directory.GetCurrentDirectory(), image.ImagePath);
                }
                return(Ok(result));
            }
            return(BadRequest(result));
        }
示例#2
0
        public IDataResult <List <CarImage> > GetCarImages(int carId)
        {
            var result = _carImageService.GetByWithCarId(carId).Data;

            if (result.Count == 0)
            {
                return(new SuccessDataResult <List <CarImage> >(new List <CarImage>()
                {
                    new CarImage()
                    {
                        CarId = carId,
                        ImagePath = "Resources/carimages/default.png"
                    }
                }));
            }
            return(new SuccessDataResult <List <CarImage> >(result));
        }