I am trying to use WebMatrix to create static html. (Think CMS.)
I have this helper in App_Code/CardHelpers.cshtml
@helper Cards (string mysuit){
// Class Tags
var ss = Html.Raw("<span class = \"spade\">");
var sh = Html.Raw("<span class = \"heart\">");
var se = Html.Raw("</span>");
// Suits
var S = Html.Raw(ss + "♠" + se);
var H = Html.Raw(sh + "♥" + se);
<p> @mysuit and @H</p>
}
I call it with
@CardHelpers.Cards("S")
The static html output is
<p> S and <span class = "heart">♥</span></p>
So I can use @H inside the helper to create the html I want, but how can I pass in a suit (such as "S") and create the appropriate html. Here, I just get back the S, but what I want to return is
<span class = "spade">♠</span>