As Title states Query to Display Custom Value when columns having fixed values in LINQ can be shown in the images...
I had a table name called partnerinfo with the following values and the query to display is
from p in Partnerinfos
select new
{
p.Partnerid,
p.Name,
p.Status,
p.Ismd
}
Now my aim is to change 1 = Yes and 0 = No from the Ismd column using LINQ.
from p in Partnerinfos
select new
{
p.Partnerid,
p.Name,
p.Status,
Ismd = p.Ismd == 1 ? "Yes":"No"
}
I had a table name called partnerinfo with the following values and the query to display is
from p in Partnerinfos
select new
{
p.Partnerid,
p.Name,
p.Status,
p.Ismd
}
Partnerid
|
Name
|
Status
|
Ismd
|
U.SOMI
REDDY
|
Active
|
1
|
|
2
|
SANTOSH
KUMAR
|
Active
|
0
|
3
|
Bacha
Ramesh
|
Active
|
0
|
4
|
Y.Vinod
Goud
|
Active
|
0
|
5
|
Ramulu
(Nehru nagar)
|
Active
|
0
|
6
|
Vikas
Reddy Umenthela
|
Active
|
1
|
7
|
U
Sherisha Reddy
|
Active
|
0
|
8
|
P
Thirupathi
|
Active
|
0
|
9
|
G.
Anjaneylu
|
Active
|
0
|
10
|
P.Bikshpathi`
|
Active
|
0
|
11
|
B.Kailash
|
Active
|
0
|
12
|
K.
Shivaji
|
Active
|
0
|
13
|
Ramulu
2
|
Active
|
0
|
Now my aim is to change 1 = Yes and 0 = No from the Ismd column using LINQ.
from p in Partnerinfos
select new
{
p.Partnerid,
p.Name,
p.Status,
Ismd = p.Ismd == 1 ? "Yes":"No"
}
Partnerid
|
Name
|
Status
|
Ismd
|
1
|
U.SOMI
REDDY
|
Active
|
Yes
|
2
|
SANTOSH
KUMAR
|
Active
|
No
|
3
|
Bacha
Ramesh
|
Active
|
No
|
4
|
Y.Vinod
Goud
|
Active
|
No
|
5
|
Ramulu
(Nehru nagar)
|
Active
|
No
|
6
|
Vikas
Reddy Umenthela
|
Active
|
Yes
|
7
|
U
Sherisha Reddy
|
Active
|
No
|
8
|
P
Thirupathi
|
Active
|
No
|
9
|
G.
Anjaneylu
|
Active
|
No
|
10
|
P.Bikshpathi`
|
Active
|
No
|
11
|
B.Kailash
|
Active
|
No
|
12
|
K.
Shivaji
|
Active
|
No
|
13
|
Ramulu
2
|
Active
|
No
|
No comments:
Post a Comment