title: Asp.NET MVC 5 display image from database
body: <p>I'm trying to display an picture from my database.
  First I made a Model called <code>ShopModels.cs</code> inside that models i have this(which i think is good for now):</p>
  
  <pre><code>    public class ShopModels
      {
          public int Id { get; set; }
          public string Title { get; set; }
          public string Photo { get; set; }
          public decimal Price { get; set; }
      }
  }
  </code></pre>
  
  <p>And after I made that model I have scaffolded my controllers and views
  In my controller I did not change anything for the images only for other things.
  And for my View(view folder called: ShopModels) what is called Detials.cshtml</p>
  
  <p>And inside my Detials.cshtml I have changed this:</p>
  
  <pre><code>@Html.DisplayFor(model =&gt; model.Photo)
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>&lt;img src="@Url.Content(@Model.Photo)" /&gt;
  </code></pre>
  
  <p>It still does not work and it also does not give me an error.</p>
  
  <hr>
  
  <p>My db looks like this:
  I have tryed tried to change </p>
  
  <blockquote>
    <p>Photos/JohnSmith.png</p>
  </blockquote>
  
  <p>to </p>
  
  <blockquote>
    <p>~/Photos/JohnSmith.png</p>
  </blockquote>
  
  <p>but still no luck</p>
  
  <p><a href="https://i.stack.imgur.com/MwzkG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MwzkG.png" alt="enter image description here"></a></p>
  
  <p>tree:</p>
  
  <p><a href="https://i.stack.imgur.com/TeLzw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TeLzw.png" alt="enter image description here"></a></p>
  
  <p>And this is the result from what i'm getting:
  <a href="https://i.stack.imgur.com/crJk9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/crJk9.png" alt="enter image description here"></a></p>
  
  <p>As you can see I'm getting text and not the image as result.</p>