I have a property
public class Robusta
{
public int Id {get;set;}
public int CoffeeId {get;set;}
public string Name {get;set;}
public string Origin {get;set;}
public string ImagePath {get;set;}
}
I have ImagePath set as ~/images/imageName.jpg in the database. ~/images/imageName.jpg works and displays image in the view if I do <img src="~/images/imageName.jpg" /> so I thought that if I set property to that string by making ImagePath='~/images/imageName.jpg' and in my View I displayed
<td>
<img src="@Html.DisplayFor(modelItem => item.ImagePath)" />
</td>
that it would work, but it does not display the image. How can I add the image as a property and display it? Because I have different images for every instance.