title: c# MVC display image from viewmodel in a razor view
body: <p>I am trying to pass an image stored in a viewmodel from my controller to my razor view. The two [barcode] images (<code>System.Drawing.Image</code>) are defined as below:</p>
  
  <pre><code>ShippingSummaryViewModel shippingSummaryVm = ShippingSummaryViewModel.ToShippingSummaryFromOrder(orders);
  shippingSummaryVm.CustIdBarcode = CreateBarcode(shippingSummaryVm.customer_code);
  shippingSummaryVm.SalesOrderBarcode = CreateBarcode(shippingSummaryVm.order_id);
  </code></pre>
  
  <p>in my view, I would like to be able to use an <code>&lt;img&gt;</code> tag to reference these images but I am not sure what to put for the source as setting the src equal to <code>@Model.CustIdBarcode</code> does not work due to getting a 404 resource not found error. All help is appreciated</p>
  
  <p>Edit: In my razor view, I am using <code>&lt;img src="@Model.SalesOrderBarcode"/&gt;</code> and <code>&lt;img src="@Model.CustIdBarcode" /&gt;</code> to try and display the images. These fields in my viewmodel look like:</p>
  
  <pre><code>public Image SalesOrderBarcode { get; set; }
  public Image CustIdBarcode { get; set; }
  </code></pre>
  
  <p>and the errors I get when rendering the page are:</p>
  
  <pre><code>GET http://localhost:63957/Orders/System.Drawing.Bitmap 404 (Not Found)
  </code></pre>