How can I make that so it will work only one condition at one time? Basically there is a time when A,B, and C can be pick at one time all of them. Example: So if you pick A there should be only one posibility and it is "else if (A != null)", but if there is A and B it should display only "else if (Model.B != null)", but if it is A,B, and C it should display only "else if (Model.SoldOut != null)". So is there any way to do that? Or is there any way to delete A when it display B, and delete A and B when it displays C?
@if (A == null & B == null & C == null)
{
@Resources.Undefined;
}
else if (A != null)
{
@Resources.ResourceManager.GetString(Model.A.GetDisplayValue());
}
else if (Model.B != null)
{
@Model.B
}
else if (Model.SoldOut != null)
{
<p>-</p>
}
>Solution :
You can do it by changing the order of else if statements
@if (A == null & B == null & C == null)
{
@Resources.Undefined;
}
else if (Model.SoldOut != null)
{
<p>-</p>
}
else if (Model.B != null)
{
@Model.B
}
else if (A != null)
{
@Resources.ResourceManager.GetString(Model.A.GetDisplayValue());
}