82
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
var db = FakeDbContext.Seed();
10
11
// write the output
12
DumpTable(db.Hato, "All HATO Records");
13
14
DateTime startDate = new DateTime(2021,05,21);
15
DateTime endDate = new DateTime(2021,05,24);
16
17
// verify the date filter results
18
DumpTable(db.Hato.Where(L => L.HatoRecDate >= startDate && L.HatoRecDate <= endDate), String.Format("HATO Between [{0:dd.MM.yyyy} - {1:dd.MM.yyyy}]", startDate, endDate));
19
20
var qLocation = (from L in db.Hato
21
where L.HatoRecDate >= startDate && L.HatoRecDate <= endDate
22
group L by L.HatoLocation into g
23
select new { HatoLocation = g.Key, count = g.Count() })
24
.OrderByDescending(o => o.count).ToList();
Cached Result