I have this five ratings:
if (model.CIIattainedrequired2021 > model.d4)
{
model.CIIrating2021 = "E";
}
if (model.CIIattainedrequired2021 < model.d4)
{
model.CIIrating2021 = "D";
}
if (model.CIIattainedrequired2021 < model.d3)
{
model.CIIrating2021 = "C";
}
if (model.CIIattainedrequired2021 < model.d2)
{
model.CIIrating2021 = "B";
}
if (model.CIIattainedrequired2021 < model.d1)
{
model.CIIrating2021 = "A";
}
I display them in tables:
<td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2019</p>
</td><td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2020</p>
</td><td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2021</p>
</td><td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2022</p>
</td><td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2023</p>
</td><td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2024</p>
</td><td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2025</p>
</td><td class="text-center px-2 py-1 mx-0 text-xs">
<p>@model.CIIrating2026</p>
And depending on the answer i would like to show the text in different colors as follow:
A-GREEN B-LIGHTGREEN C-YELLOW D-ORANGE E-RED