Ejemplo n.º 1
0
        public IActionResult Add(CarImage carImage)
        {
            var imageSave = new NormalImageSave();

            _carImageService.ImageSaveBase(imageSave);
            var result = _carImageService.Add(carImage);

            if (result.Success == true)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Ejemplo n.º 2
0
        //[Route("api/Temp/{dataImagePath}")]
        public IActionResult View(int id)
        {
            var imageSave = new NormalImageSave();

            _carImageService.ImageSaveBase(imageSave);
            var result = _carImageService.View(id, _env.WebRootPath);

            if (result.Success == true)
            {
                string fileExtension = result.Data.Name.Substring(result.Data.Name.IndexOf("."), result.Data.Name.Length - result.Data.Name.IndexOf("."));
                return(File(result.Data, @"image/" + fileExtension.Replace(".", "")));
            }
            return(BadRequest(result));
        }