Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var teamsWithFootballers = context.Teams
- .ToList()
- .Where(x => x.TeamsFootballers.Any(x => x.Footballer.ContractStartDate >= date))
- .Select(x => new
- {
- Name = x.Name,
- Footballers = x.TeamsFootballers
- .Where(f => f.Footballer.ContractStartDate >= date)
- .OrderByDescending(f => f.Footballer.ContractEndDate)
- .ThenBy(f => f.Footballer.Name)
- .Select(f => new
- {
- FootballerName = f.Footballer.Name,
- ContractStartDate = f.Footballer.ContractStartDate.ToString("d", CultureInfo.InvariantCulture),
- ContractEndDate = f.Footballer.ContractEndDate.ToString("d", CultureInfo.InvariantCulture),
- BestSkillType = f.Footballer.BestSkillType.ToString(),
- PositionType = f.Footballer.PositionType.ToString()
- }).ToList()
- })
- .OrderByDescending(x => x.Footballers.Count)
- .ThenBy(x => x.Name)
- .Take(5)
- .ToList();
- return JsonConvert.SerializeObject(teamsWithFootballers, Formatting.Indented);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement