Beispiel #1
0
        public void SeedEverything(PontoFidelidadeContexto context)
        {
            context.Database.EnsureCreated();

            if (context.Loja.Any())
            {
                return; // Db has been seeded
            }

            var lojas   = SeedLojas(context);
            var clients = SeedClients(context, lojas.First().LojaId);
        }
Beispiel #2
0
        public Cliente[] SeedClients(PontoFidelidadeContexto context, Guid idLoja)
        {
            var clients = new[]
            {
                ClienteNovo(idLoja, "Maria Anders", "1979-11-01", "67845803030"),
                ClienteNovo(idLoja, "Ana Trujillo", "1993-02-27", "71734065010", 10M, 20),
                ClienteNovo(idLoja, "Antonio Moreno", "1995-12-11", "81244982024", 2M, 50),
                ClienteNovo(idLoja, "Thomas Hardy", "1990-05-08", "73793266001", 5M, 200),
                ClienteNovo(idLoja, "Christina Berglund", "1980-05-30", "11972287052", 10M, 100),
            };

            context.Cliente.AddRange(clients);
            context.SaveChanges();

            return(clients);
        }
Beispiel #3
0
        public Loja[] SeedLojas(PontoFidelidadeContexto context)
        {
            var Lojas = new[]
            {
                LojaNovo("Loja da Vittoria", "2018-05-08", "93984583000113", new Guid("4B335B6F-9C4D-47F7-B798-C46FFBC4881A"), "1"),
                LojaNovo("Minhas roupas na moda!", "2011-11-01", "62297611000109"),
                LojaNovo("Hamburguers top", "2002-02-27", "15655888000178"),
                LojaNovo("Comida Cazeira da Maria", "2019-02-11", "02649929000171"),
                LojaNovo("Periféricos PontoCom", "2018-05-30", "06936230000143"),
                LojaNovo("Posto MeuAmigo", "2015-10-10", "30519970000169"),
            };

            context.Loja.AddRange(Lojas);
            context.SaveChanges();

            return(Lojas);
        }
Beispiel #4
0
        public static void Initialize(PontoFidelidadeContexto context)
        {
            var initializer = new PontoFidelidadeSeed();

            initializer.SeedEverything(context);
        }