SO is not a website when you throw everything here and expected people finish the job for you.
Anyway, to give you some hint, I give you a straight suggestion:
Select CostGroupId From CostGroups Where CostGroupType = 1
–> Stored these in A collection, like an array:
var costGroupsIdArr = ctx.CostGroup.Where(x=>x.CostGroupType == 1).Select(x.CostGroupId).toArray();
Then from here, get your main query:
Select *
From Document
Where DocumentNumber = @Number
Here is the last result:
var result = ctx.Document.Where(x=>x.DocumentNumber == number && vostGroupsIdArr.Contains(x.CostGroupId)).ToList();
You can try to figured out yourself what else needed from my snippet
solved How can I write this stored procedure with EF in C# [closed]