Я использую бритвенный движок mvc3
из вида Я вызываю функцию с Uri.Action, которая возвращает FilecontentResult
<img src="@Url.Action("GetImg", "Controller", new { id = Model.Id })" alt="Person Image" />
Функция:
public FileContentResult GetImg(int id)
{
var byteArray = _context.Attachments.Where(x => x.Id == id).FirstOrDefault();
if (byteArray != null)
{
return new FileContentResult(byteArray.Content, byteArray.Extension);
}
return null;
}
if byteArrayis empty функция возвращает нуль
как узнать из представления, что вернула функцию?
Мне нужно что-то вроде этого
if(byteArray == null)
<img src="default img" alt="Person Image" />
else
{
<a class="highslide" href="@Url.Action("GetImg", "Controller", new { id = Model.Id })" id="thumb1" onclick="return hs.expand(this)">
<img src="@Url.Action("GetImg", "Controller", new { id = Model.Id })" alt="Person Image" /> </a>
}