var records = from entity in q1.question_papers
select new
{
QuestionPaperID = entity.QUESTION_PAPER_ID,
SubjectID = entity.SUBJECT_ID,
PreviousAttempts = SubIdAtt.Where(c => c.SUBID == entity.SUBJECT_ID)
.Select(c => c.ATT)
.FirstOrDefault(),
};
Above is my linq query where in PreviousAttempts field I get null value if doesn't satisfy where. So instead of containing null I want to change this 0 if it contains null and restore original value if it doesn't contain non null value.
How can I achieve this since I am not able to change PreviousAttempts through for each of record?