I have a page like this:
As you can see, there are True and False values in the Urgent and Done sections. I want to change these posts.
I want it to write "Yes" if True and "No" if False. How I can do that?
My codes:
@using ToDoListApp.Models
@model List<TodoTable>
<table class="table table-hover">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Task</th>
<th scope="col">Urgent</th>
<th scope="col">Done</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<th scope="row">@item.Id</th>
<td>@item.Name</td>
<td>@item.Urgent</td>
<td>@item.Done</td>
</tr>
}
</tbody>
</table>
Thanks for help.
>Solution :
You can use an @if or for cleaner code you can use the ternary operator : ?.
<td>@(item.Urgent ? "Yes" : "No")</td>
<td>@(item.Done ? "Yes" : "No")</td>
