Created
April 27, 2015 19:50
-
-
Save warrenbuckley/28243300b2907677a1fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
//Obviously get header from umbraco value | |
var header = string.empty; | |
var mainHeader = Model.Content.GetPropertyValue<string>("mainHeader"); | |
var secondaryHeader = Model.Content.GetPropertyValue<string>("secondaryHeader"); | |
var nodeName = Model.Content.Name; | |
//Check if we have mainHeader value, fallback to secondaryHeader | |
header = !string.IsNullOrEmpty(mainHeader) : mainHeader ? secondaryHeader; | |
//Check again as the variable secondary header still could be null or empty string | |
//This time check header variable itself. If it's still emtpy or null fallback to nodename | |
header = !string.IsNullOrEmpty(header) : header ? nodeName; | |
} | |
<h1>@header</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
okay, i see stacked ternaries then... right!