I am using that switch case to select the index of the foreach, and using and if statement to increment model.Hours1(2,3,4,5...)
but know I want to do this for hours100. How can i do?
switch (colNames.IndexOf(item2))
{
case 0:
if (model.Hours == null)
{
item.Hours = 0;
}
else
{
item.Hours = (decimal)model.Hours;
item.Hours_Remaining = (decimal)model.Hours;
}
break;
case 1:
if (model.Hours1 == null)
{
item.Hours = 0;
}
else
{
item.Hours = (decimal)model.Hours1;
item.Hours_Remaining = (decimal)model.Hours;
}
break;
}
Aucun commentaire:
Enregistrer un commentaire