I´m trying to make this sql request
SELECT number, COUNT(number)
FROM Bet GROUP BY number ORDER BY COUNT(number) DESC;
Code
public static List<Apuesta> GetAllNumbers(ApplicationDbContext db)
{
List<Bet> bets = (from b in db.Bet select b.Number).Count();
return bets;
}
and i want to use it in one function using linq.
Count) to aList<Bet>. Do you want a list that contains the number ofNumberin eachBet? (so aList<int>)List<int> bets = (from b in db.Bet select b.Number.Count()).ToList();should work