Trying to populate table data with:
@foreach (var mc in Model.McList)
{
<tr>
<td>
@(@mc.Amount != null ? @mc.Amount @@ @mc.Price : null)
</td>
</tr>
}
but stuck in razor syntax errors:
expect :
expect )
or ambiguous invocation: void Write
Amount is int? nullable type.
@(@mc.Amount != null ? @mc.Amount : null) //works only with one property
@if (@mc.Amount != null) {@mc.Amount <text>@@</text> @mc.Price} //works
@if (@mc.Amount != null) {@mc.Amount @@ @mc.Price} //error
@if (@mc.Amount != null) {@mc.Amount @:@@ @mc.Price} //error
is it shorter way to check for null value without if?
120 @ 30.50