public async Task <ActionResult <IEnumerable <Match> > > GetTopTenMatches(MatchDuration duration) { _context.HowManyGamesPlayed(); _context.AverageScore(); // var myMatch = await _context.match.FromSqlRaw( // "SELECT * FROM `match`WHERE `match`.`date`>= CAST({0} AS DATE) AND `match`.`date` <= CAST({1} AS DATE) " + // "ORDER BY `match`.`score` DESC LIMIT 10;", duration.FromDate, duration.ToDate).ToListAsync(); var myMatch = await _context.match.Where(x => x.date >= duration.FromDate& x.date <= duration.ToDate) .OrderByDescending(x => x.score).Take(10).ToListAsync(); if (myMatch == null) { return(NotFound()); } return(myMatch); }