I'm having the following situation (in razor using ASP.NET):
@if(@groups.Users != null)
{
@foreach(var user in @groups.Users)
{
@if(@user.UserId == VALUE)
{
CASE 01
break;
}
}
CASE 02
}
else
{
SHOW CASE 02
}
So all I want is CASE 01 if the Value is in the collection of @user.UserId. And else display CASE02.
But, because if there are no users in the group, then it should display CASE02 too. Pretty simple I thought.
Now this does not work (after it shows CASE 01, it also shows the CASE02(because of the else). Else the code works fine.
I tried putting another 'break;' after the CASE 02 in the if statement, but then it cuts off my code?
I think I'm just missing something here ...
I hope I explained it right? Thank you
Aucun commentaire:
Enregistrer un commentaire