I have an MVC application that displays the progress of Windows deployments. In my view, I have a table that displays the current status of each deployment. One of those properties is the last time the deployment checked in ('CurrentTime'). I want to change the style of the if the CurrentTime is more than 4 hours ago.
In my MVC view, I am trying to do something like this:
@foreach (var item in Model)
{
if(item.CurrentTime < DateTime.Now.AddHours(-4))
{
@:<tr class="warning">
}
else
{
@:<tr>
}
This is not working. I am getting a parser error:
Encountered end tag "tr" with no matching start tag. Are your start/end tags properly balanced?
What is a simple way (I am just learning MVC/web programming) to accomplish this?