Case Statement inside LINQ
Example of a mock Case Statement inside LINQ wrapped inside the parens.
var territoryInfo= (from e in Franchisee_Zips
where e.AccountCode == accountcode
select new Data.FullTerritory
{
AccountCode = e.AccountCode,
VendorName = e.VendorName,
Territory_Type = (e.TerritoryType == 0 ? "TAFS" :
e.TerritoryType == 1 ? "Purchased Territory" :
e.TerritoryType == 3 ? "Option" :
e.TerritoryType == 4 ? "Vendor" : "Unknown"
),
OptionBegins = e.OptionBegins,
OptionExpires = e.OptionExpires,
Action = "Add"
});
Comments