Beispiel #1
0
 public IndexModel(xau.Models.XauContext context)
 {
     _context = context;
 }
Beispiel #2
0
 public DeleteModel(xau.Models.XauContext context)
 {
     _context = context;
 }
Beispiel #3
0
 public EditModel(xau.Models.XauContext context)
 {
     _context = context;
 }
Beispiel #4
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new XauContext(
                       serviceProvider.GetRequiredService <DbContextOptions <XauContext> >()))
            {
                // Check if the DB has been seeded
                if (!context.Entrega.Any())
                {
                    // Seed the Proveedores
                    context.Proveedor.AddRange(
                        new Proveedor {
                        Nombre = "Proveedor A", Email = "*****@*****.**", Telefono = "123456"
                    },
                        new Proveedor {
                        Nombre = "Proveedor B", Email = "*****@*****.**", Telefono = "098765"
                    },
                        new Proveedor {
                        Nombre = "Proveedor C", Email = "*****@*****.**", Telefono = "564738"
                    }
                        );
                    context.SaveChanges();
                }


                if (!context.Recolector.Any())
                {
                    // Seed the Recolectores
                    context.Recolector.AddRange(
                        new Recolector {
                        Nombre = "Recolector Uno", Email = "*****@*****.**", Telefono = "135791"
                    },
                        new Recolector {
                        Nombre = "Recolector Dos", Email = "*****@*****.**", Telefono = "246802"
                    },
                        new Recolector {
                        Nombre = "Recolector Tres", Email = "*****@*****.**", Telefono = "098765"
                    }
                        );
                    context.SaveChanges();
                }

                if (!context.Entrega.Any())
                {
                    // Seed the Entregas
                    context.Entrega.AddRange(
                        new Entrega {
                        Fecha = DateTime.Now.AddDays(-2), Peso = new decimal(601.3), LeyRecuperable = new decimal(921.26), ProveedorID = 4, RecolectorID = 4, status = EntregaStatus.pendiente, OwnerID = "51a76e6a-e9e3-44d7-ae20-adce78016de7"
                    },
                        new Entrega {
                        Fecha = DateTime.Now.AddDays(-1), Peso = new decimal(345.7), LeyRecuperable = new decimal(928.87), ProveedorID = 4, RecolectorID = 4, status = EntregaStatus.pendiente, OwnerID = "51a76e6a-e9e3-44d7-ae20-adce78016de7"
                    },
                        new Entrega {
                        Fecha = DateTime.Now.AddDays(-2), Peso = new decimal(155.4), LeyRecuperable = new decimal(919.6), ProveedorID = 5, RecolectorID = 4, status = EntregaStatus.pendiente, OwnerID = "51a76e6a-e9e3-44d7-ae20-adce78016de7"
                    },
                        new Entrega {
                        Fecha = DateTime.Now.AddDays(-1), Peso = new decimal(143.9), LeyRecuperable = new decimal(929), ProveedorID = 5, RecolectorID = 4, status = EntregaStatus.pendiente, OwnerID = "51a76e6a-e9e3-44d7-ae20-adce78016de7"
                    },
                        new Entrega {
                        Fecha = DateTime.Now, Peso = new decimal(502.3), LeyRecuperable = new decimal(913.7), ProveedorID = 6, RecolectorID = 4, status = EntregaStatus.pendiente, OwnerID = "51a76e6a-e9e3-44d7-ae20-adce78016de7"
                    }
                        );
                    context.SaveChanges();
                }
            }
        }
Beispiel #5
0
 public DetailsModel(xau.Models.XauContext context)
 {
     _context = context;
 }
Beispiel #6
0
 public CreateModel(xau.Models.XauContext context)
 {
     _context     = context;
     FechaEntrega = DateTime.Now;
 }
Beispiel #7
0
 public CreateModel(xau.Models.XauContext context)
 {
     _context = context;
 }