Пример #1
0
        public static void SeedDataForContext(this PrimeNumberContext context)
        {
            if (context.PrimeNumbers.Any())
            {
                return;
            }


            var primes = new List <PrimeNumber>()
            {
                new PrimeNumber()
                {
                    IndexPrime = 1,
                    ValuePrime = 2
                },
                new PrimeNumber()
                {
                    IndexPrime = 2,
                    ValuePrime = 3
                }
            };

            context.PrimeNumbers.AddRange(primes);
            context.SaveChanges();
        }
 public bool Save()
 {
     return(_context.SaveChanges() >= 0);
 }