Here is my model
public class MyModel
{
public System.Drawing.Image MyImage { get; private set; }
public MyModel(System.Drawing.Image myImage)
{
this.MyImage = myImage;
}
}
Here is my view
@model MyModel
@using MyNamespace.MyModels;
@{
ViewBag.Title = "title";
}
<img id="11111" src="@Model.MyImage" alt="Hello alt text" />
Here is my controller
public class MyController : Controller
{
public ActionResult Index()
{
Image img = GoAndGetImage(55);
MyModel model = new MyModel(img);
return View(model);
}
private System.Drawing.Image GoAndGetImage(int id)
{
// Retrieve bytesArray from sql db, convert to System.Drawing.Image type
}
}
But I only get to see Hello alt text and not the real image. What am I doing wrong?