Wondering if I can conditionally concatenate LINQ query results from 4 different fields in a table, which are flags into 1 string for each record, so it would be something like this:
dbContext.CONTACT_LOGs.Select( e => new
(e => new ContactLog
{
rec1 = e.Recommend1 ? "1 is recommended" : String.Empty,
rec2 = e.Recommend2 ? "2 is recommended" : String.Empty,
rec3 = e.Recommend3? "3 is recommended" : String.Empty,
rec4 = e.Recommend4 ? "4 is recommended" : String.Empty
//this doesn't work in a single query
ContactSummary = String.Concat(rec1, rec2, rec3, rec4)
});
public class ContactLog
{
public string rec1 { get; set; }
public string rec2 { get; set; }
public string rec3 { get; set; }
public string rec4 { get; set; }
public string ContactSummary { get; set; }
}
Is there any way to do that in that fashion? Thanks