have the following image, from a database...
<img src="@Url.Action("GetLogo", "Logo", new { ID = 16})" />
And the controller....
public FileContentResult GetLogo(int ID)
{
var GetImage = (from x in repository.GetClientLogo
where x.ClientID == ClientID
select x).FirstOrDefault();
ClientLogo clientLogo = GetImage;
return File(clientLogo.ImageData, clientLogo.ImageMimeType);
}
This all works fine until there is no database record - if this is the case, then I want to return a default image (example <img src="../Images/NoLogo.jpg" />
), but I'm having difficulties as the above controller returns FileContentResult
.
Any help would be appreciated.