Thursday, March 17, 2016

How to Replace 0 with 1 in Linq to Entity ? (Linq if-statement)




Description:
first it is asking column1==0 ? if true 1 will assign to column1  for assignment here use : operator

Basic Example:
column1= = 0 ? 1 : column1

Real Example:

let value1 = Grp.Count(x => x.Column1== "value") == 0 ? 1 : Grp.Count(x => x.hours_to_resolve <= 3 && x.Column1== "value") 
/
 Convert.ToDouble(Grp.Count(x => x.Column1== "value") == 0 ? 1 : Grp.Count(x => x.Column1== "value"))

No comments:

Post a Comment

Secure you Asp .NET by Web.config & Global.ascx?

Add to Global.ascx protected void Application_BeginRequest(object sender,EventArgs e)     {         //to remove x frame         Resp...