I am in Visual Studio view of the MVC (razor code). I have the same bool "if statemant" being used several times in different area's of the code. I have been told that I could save the results of the first if statement and reuse the results so I don't have to write the "if statement" several times over.
How do I save the results of the first if statement and reuse the results below?
var IsManager = someRole;
var IsTeamLead= someOtherRole;
if(IsManager || ITeamLead)
{
//Veiew this resticted content on the application;
}
//Code;
//Code;
if(IsManager || IsTeamLead)
{
//Veiew more resticted content on the application;
}
//Little more code;
//Little more Code;
if(IsManager || Is TeamLead)
{
//Veiew this content too;
}
//Little more code
//Little more code
//Little more code
if(IsManager || IsTeamLead)
{
//Veiew this content;
}
Aucun commentaire:
Enregistrer un commentaire