title: MVC - Store PDF in view model and embed in view?
body: <p>I have a controller action that I can call and it returns a pdf file from a byte array.  This works properly and I can view my document embedded on the page with this razor action:</p>
  
  <pre><code>&lt;embed src="@Url.Action("Preview_PDF", "Doc", new { file_name = @Model })" width="100%" height="100%" type="application/pdf"&gt;&lt;/embed&gt;
  </code></pre>
  
  <p>Is there a way to embed the file from a view model instead? for example</p>
  
  <pre><code>&lt;embed src="@Model.file" width="100% " height="100%" type="application/pdf"&gt;&lt;/embed&gt;
  </code></pre>
  
  <p>I'm using "return File" from my controller, which is not something that I can set into my model class, as File is a static type, it won't let me declare it as a variable.</p>
  
  <p>How would I be able to embed the file on a page from a model?  I can store the file as a byte array, but I do not know how to reconstruct it on the view.</p>