Please help me to get records from array 'attachment' having same date as that of list 'event' (in example records with attachment id=42). If two records in attachment is having same date then record with highest attachment id is need to be selected. Here Event is a list
Fig1
So that the final result should be like this.
I tried as following, but it doesn't work
CodePudding user response:
dataEvents = dataEvents.Select(e =>
{
e.Item.Entity.Attachments = new Attachments[]
{ (e.Item.Entity.Attachments.Where(x => x.ActualDate==e.ActualDate).OrderByDescending(p => p.Id).FirstOrDefault()) };
return e;
});