_context.Orders.Where(x => x.CreatedAt >= DateTimeOffset.FromUnixTimeMilliseconds(filter.TimeFrom) && x.CreatedAt <= DateTimeOffset.FromUnixTimeMilliseconds(filter.TimeTo))
.Include(x => x.Good).Where(x => x.Good != null)
.GroupBy(o => o.GoodId)
.Select(g => new
{
GoodId = g.Key,
GoodName = _context.Goods.AsNoTracking().FirstOrDefault(x => x.GoodId == g.Key).Name,
Delivery = g.Count(o => o.Status == (int) OrderStatusEnum.Delivery),
Cancelled = g.Count(o => o.Status == (int) OrderStatusEnum.Cancelled),
InReview = g.Count(o => o.Status == (int)OrderStatusEnum.InReview),
Total = g.Count()
})
.ToList()