CapRaffle.PopulateDatabase.Program.GetRandomCategoryId C# (CSharp) Méthode

GetRandomCategoryId() public static méthode

public static GetRandomCategoryId ( ) : int
Résultat int
        public static int GetRandomCategoryId()
        {
            var numberofCategories = repository.Categories.Count();
            int index = random.Next(0, numberofCategories);
            return repository.Categories.ToList().ElementAt(index).CategoryId;
        }