0

Error

Compiler Error Message: CS1502: The most appropriate method to overload 'System.Web.WebPages.WebPageExecutingBase.Write (System.Web.WebPages.HelperResult)' has some invalid arguments

 @ImageResultHelper.Image<ShowcaseController>(c => c.FileContentResult(), 200, 50, "Current time")

and I need transmit new { bytes = item.ImageItems } to FileContentResult

den den
  • 469
  • 2
  • 6
  • 9

1 Answers1

4

The way we do it, is we return a FileContentResult:

public FileResult Get()
{
    return new FileContentResult(image.Bytes, image.ContentType);
}

Then we set the src of the image to this action:

<img src="/Controller/Get/" alt="Whatever" />

This way you can cache the result.

Martin
  • 11,031
  • 8
  • 50
  • 77