Build the HTML with a string.Format. Something like this:
c.ExistsInPatRec
? string.Format("<a href='{0}' target='_blank'>Details</a><img src='{1}' />"
Url.Action(c.CaseNumber.ToString(), new { id = c.CaseNumber }),
urlToImage)
: Html.Label(c.CaseNumber.ToString()))