So i am trying to have a ternary operator inside the viewmodel. NOTE: RegionId is int. This is the code
var model = (from p in _context.ProductGun
where p.ProductId == productId
select new GunViewModel)
{
RegionId = p.RegionId == 1 ? "DEV" : "TEST"; //error
}
I've tried:
RegionId = p.RegionId.ToString() == "1" ....;
RegionId = p.RegionId == Convert.ToInt32(1);
And vice versa solutions. But nothing is correct. Sorry for the typo. I type this using mobile
int...RegionIdis an int, why do you think its ok to assign it "DEV"? "DEV" is a string, not anint