Users Pricing

forum

home / developersection / forums / ternary operator in razor using a @model

Ternary operator in razor using a @Model

Anonymous User 3261 05 Feb 2015

I am trying to use the ternary operator in this piece of code, where Model.FirstTechSupportAssigneeElapseTime is of type TimeSpan?:

<dt>Assigned In</dt>
<dd>
@if (@Model.FirstTechSupportAssigneeElapseTime == null)
     { @:N/A }
else
     { @Model.FirstTechSupportAssigneeElapseTime }
</dd>

I have tried to implement the the ternary operator but I am failing miserably, the @'s everywhere are confusing me. Is it possible to have a the ternary operator in this scenario?

Thank you.


I am a content writter !


1 Answers