Hi @Divya_Sadhasivam,
Please check this topic. Using If Condition in LINQ
It should help.
Regards. Ömer