A
Ant
Hi,
I'm trying to use a swithc statement in a LINQ query but its not ahppy at all.
Any ideas as to the correct way to go about this?
Many thanks for any ideas
Ant
Below is the statement:
var resultSet = from p in db.Projects
where p.ProjectCode == textboxProjectCode.Text &&
p.RevisionStatusCode == 'A'
select new
{
p.ProjectCode,
p.RevisionNum,
"StatusCode" =
switch (p.StatusCode)
{
case 'I':
"Inactivated";
break;
case 'E':
"Engaged";
break;
case 'C':
"Closed";
break;
case 'P':
"Planned";
break;
default:
"default";
break;
},
p.RevisionName,
p.LastUpdateUserID,
p.LastUpdateDate
};
I'm trying to use a swithc statement in a LINQ query but its not ahppy at all.
Any ideas as to the correct way to go about this?
Many thanks for any ideas
Ant
Below is the statement:
var resultSet = from p in db.Projects
where p.ProjectCode == textboxProjectCode.Text &&
p.RevisionStatusCode == 'A'
select new
{
p.ProjectCode,
p.RevisionNum,
"StatusCode" =
switch (p.StatusCode)
{
case 'I':
"Inactivated";
break;
case 'E':
"Engaged";
break;
case 'C':
"Closed";
break;
case 'P':
"Planned";
break;
default:
"default";
break;
},
p.RevisionName,
p.LastUpdateUserID,
p.LastUpdateDate
};