- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
var ChildListWithCondition =
(from list in ChildList
join requestedRelatedEntityIds in EntitiesIdInList on list.ParentEntityId equals requestedRelatedEntityIds
join requestedEntityType in EntityTypeIdToTake on list.EntityTypeId equals requestedEntityType)
.Select(list =>
new LayoutDataOutputStructure()
{
ParentEntityId = list.ParentEntityId,
EntityId = list.EntityId,
FieldId = list.FieldId,
FieldValue = list.FieldValue,
EntityTypeId = list.EntityTypeId,
RelationTypeToParent = list.RelationTypeToParent,
FieldValueId = list.FieldValueId
})
.GroupBy(item => item.ParentEntityId)
.Select(group => new
{
ParentEntityId = group.Key,
GroupEntityTypeId = group.GroupBy(item => item.EntityTypeId)
.Select(group2 => new
{
EntityTypeId = group2.Key,
EntityRelation = group2.Select(item => item.RelationTypeToParent).FirstOrDefault(),
GroupEntityId = group2.GroupBy(group3 => group3.EntityId)
.Select(group3 => new
{
EntityId = group3.Key,
Fields = group3.GroupBy(group4 => group4.FieldId)
.Select(group4 => new { FieldId = group4.Key, FieldValues = group4 })
})
}
)
}
)
.ToList();