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(),
Approved = _db.Messages.Count(x => x.Approved),
Rejected = _db.Messages.Count(x => !x.Approved),
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…