public IActionResult GetImageById(int ImageId) { var ParkImage = _repository.GetImageById(ImageId); FileContentResult ImageFile = null; foreach (ParkImage park in ParkImage) { if (park.Image == null) { ImageFile = null; break; } ImageFile = File(park.Image, "image/jpg"); break; } return(ImageFile); }