Sorry if this has been asked, but how can I improve the following with a single call to the database?
var statsModel = new { Total = _db.Messages.Count(
In C# (rather than LINQ query), async syntax:
var statsModel = await _db.Messages .GroupBy(m => 1, (g, mm) => new { Total = mm.Count(), Approved = mm.Count(m => m.Approved), Rejected = mm.Count(m => !m.Approved) }) .SingleAsync();