I have the following table:

Cans 
Id: int 
HospitalId: (Foreign Key) int 
operDt: DateTime

I need to calculate the total number of cans rows grouped by hospitalId

to get a simillar result without Id
[![enter image description here](https://i.stack.imgur.com/Fb5ys.png)](https://i.stack.imgur.com/Fb5ys.png)
The repository :

```
 public Task GetCansMin(DateTime startdt, DateTime enddt)
        {
            using (appContext)
            {
                return appContext.Cans.Where(c => c.OperDt > startdt && c.OperDt < enddt).GroupBy(c => c.HospitalId)
                      .Select(g => new
                      {
                          NumberofCancelled = g.Count() 
                      }).ToArrayAsync();

            };
        }

```

The controller:

```
 [HttpGet("bydate")]
        public IActionResult GetCanMin(DateTime startdt, DateTime endd)
        {
            var res = this._unitOfWork.Cans.GetCansMin(startdt, endd);
            return Ok(res);
        }

```

When passing the request with postman:

<http://localhost:56964/api/cansdatas/bydate?startdt=2016-01-01&enddt=2016-12-31>

instead of receiving an array of results I get an empty object....
Could you help?