title: How to Store an Image in Database and then Display it in MVC
body: <p>How to store Image in Database and then retrieve and display it using MVC</p>
  <p>I am Using MVC3, Entity Framework Database First, and SQL SERVER 2008</p>
  <p>In Database I have used varbinary(MAX) for the Image</p>
  <pre><code>Image   varbinary(MAX)  Checked
  </code></pre>
  <p>Further I used</p>
  <pre><code>[DisplayName(&quot;Image&quot;)]
      public byte[] Image { get; set; }
  </code></pre>
  <p>in my mapping class</p>
  <p>When I tried to save it in my Create action method</p>
  <pre><code>public ActionResult Create(MarjaaModel newMarjaa, HttpPostedFileBase uploadFile)
      {
          if (uploadFile != null &amp;&amp; uploadFile.ContentLength &gt; 0)
          {                               
              newMarjaa.Image = new byte[uploadFile.ContentLength];
              uploadFile.InputStream.Read(newMarjaa.Image, 0, uploadFile.ContentLength);
          }
          try
          {
              data.submitMarjaa(newMarjaa);
              return RedirectToAction(&quot;Index&quot;);
          }
          catch
          {
              return View();
          }
      }
  </code></pre>
  <p>I am successful in saving the image as binary data</p>
  <p>But please tell me how I can retrieve this image and display it in my View</p>