Esempio n. 1
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new BulbasaurDevContext(
                serviceProvider.GetRequiredService <
                    DbContextOptions <BulbasaurDevContext> >()))
     {
         // Look for any registries.
         if (context.Registry.Any())
         {
             // DB has been seeded
         }
         else
         {
             context.Registry.AddRange(
                 new Registry
             {
                 TaskId  = 1,
                 UserId  = 1,
                 Hours   = 7,
                 Created = new DateTime(2020, 12, 8),
                 Date    = new DateTime(2020, 12, 8),
                 Invoice = InvoiceType.NotInvoicable
             }
                 );
         }
     }
 }
Esempio n. 2
0
        public static BulbasaurDevContext GetContextWithData()
        {
            var options = new DbContextOptionsBuilder <BulbasaurDevContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            var context = new BulbasaurDevContext(options);

            //context.Add(new User() { userId = 1, eMail = "*****@*****.**", password = "******", userName = "******" });
            context.SaveChanges();

            return(context);
        }
Esempio n. 3
0
 public static void UpdateContext(BulbasaurDevContext dbcontext) => dbcontext.Database.EnsureCreated();
Esempio n. 4
0
 public CustomerRepository(BulbasaurDevContext context)
     : base(context)
 {
 }
 public RegistryRepository(BulbasaurDevContext context)
     : base(context)
 {
 }
Esempio n. 6
0
 public GenericRepository(BulbasaurDevContext context)
 {
     this._context = context;
     _table        = context.Set <T>();
 }
 public UserRepository(BulbasaurDevContext context)
     : base(context)
 {
 }
 public MissionMemberRepository(BulbasaurDevContext context)
     : base(context)
 {
 }
Esempio n. 9
0
 public UnitOfWork(BulbasaurDevContext context)
 {
     this._context = context;
 }
Esempio n. 10
0
 public TaskRepository(BulbasaurDevContext context)
     : base(context)
 {
 }
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new BulbasaurDevContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <BulbasaurDevContext> >()))
            {
                // Look for any users.
                if (context.User.Any())
                {
                    // DB has been seeded
                }
                else
                {
                    context.User.AddRange(
                        new User
                    {
                        UserName = "******",
                        Password = "******",
                        EMail    = "*****@*****.**",
                    },
                        new User
                    {
                        UserName = "******",
                        Password = "******",
                        EMail    = "*****@*****.**",
                    },
                        new User
                    {
                        UserName = "******",
                        Password = "******",
                        EMail    = "*****@*****.**",
                    },
                        new User
                    {
                        UserName = "******",
                        Password = "******",
                        EMail    = "*****@*****.**",
                    },
                        new User
                    {
                        UserName = "******",
                        Password = "******",
                        EMail    = "*****@*****.**",
                    }
                        );
                };

                // Look for any customers.
                if (context.Customer.Any())
                {
                    // DB has been seeded
                }
                else
                {
                    context.Customer.AddRange(
                        new Customer
                    {
                        Name    = "DHL",
                        Created = new DateTime(2020, 8, 5)
                    },
                        new Customer
                    {
                        Name    = "Nike",
                        Created = new DateTime(2020, 8, 5)
                    },
                        new Customer
                    {
                        Name    = "Ikea",
                        Created = new DateTime(2020, 8, 5)
                    },
                        new Customer
                    {
                        Name    = "ICA",
                        Created = new DateTime(2020, 8, 5)
                    }
                        );
                }
                context.SaveChanges();
            }
        }
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new BulbasaurDevContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <BulbasaurDevContext> >()))
            {
                // Look for any tasks.
                if (context.Task.Any())
                {
                    // DB has been seeded
                }
                else
                {
                    context.Task.AddRange(
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 1,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 1,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 1,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 1,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 1,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 2,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 2,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 2,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 2,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 2,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 3,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 3,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 3,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 3,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 3,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 4,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 4,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 4,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 4,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 5,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 5,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 5,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 5,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 5,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 5,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 6,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 6,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 6,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 6,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 6,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 7,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 7,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 7,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 7,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 7,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 8,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 8,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 8,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 8,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 8,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 9,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 9,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 9,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 9,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 9,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 10,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Meeting with customer",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Meeting with customer",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 10,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Analysis",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Analysis",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 10,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Design",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Design",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    },
                        new Task
                    {
                        UserId        = 2,
                        MissionId     = 10,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 11, 5),
                        Description   = "Implementation",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.NotInvoicable,
                        Name          = "Implementation",
                        Start         = new DateTime(2020, 12, 6),
                        Finished      = new DateTime(2020, 12, 7)
                    },
                        new Task
                    {
                        UserId        = 1,
                        MissionId     = 10,
                        Status        = 0,
                        ActualHours   = null,
                        Created       = new DateTime(2020, 10, 5),
                        Description   = "Support",
                        EstimatedHour = 8.30,
                        Invoice       = InvoiceType.Invoicable,
                        Name          = "Support",
                        Start         = new DateTime(2020, 10, 6),
                        Finished      = null
                    }
                        );
                }

                // Look for any missionmembers.
                if (context.MissionMember.Any())
                {
                    // DB has been seeded
                }
                else
                {
                    context.MissionMember.AddRange(
                        new MissionMember
                    {
                        UserId    = 1,
                        MissionId = 1
                    },
                        new MissionMember
                    {
                        UserId    = 1,
                        MissionId = 2
                    },
                        new MissionMember
                    {
                        UserId    = 1,
                        MissionId = 3
                    },
                        new MissionMember
                    {
                        UserId    = 1,
                        MissionId = 4
                    }
                        );
                }

                // Look for any favoritemissions.
                if (context.FavoriteMission.Any())
                {
                    // DB has been seeded
                }
                else
                {
                    context.FavoriteMission.AddRange(
                        new FavoriteMission
                    {
                        UserId    = 1,
                        MissionId = 1
                    },
                        new FavoriteMission
                    {
                        UserId    = 1,
                        MissionId = 3
                    }
                        );
                    context.SaveChanges();
                }
            }
        }
 public FavoriteMissionRepository(BulbasaurDevContext context) : base(context)
 {
 }
Esempio n. 14
0
 public static void Initialize(IServiceProvider serviceProvider)
 {
     using (var context = new BulbasaurDevContext(
                serviceProvider.GetRequiredService <
                    DbContextOptions <BulbasaurDevContext> >()))
     {
         // Look for any missions.
         if (context.Mission.Any())
         {
             // DB has been seeded
         }
         else
         {
             context.Mission.AddRange(
                 new Mission
             {
                 Created     = new DateTime(2020, 8, 5),
                 Description = "Project1 for DHL",
                 Finished    = null,
                 MissionName = "DHL Project1",
                 Color       = "#F0D87B",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 1
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 9, 5),
                 Description = "Project2 for DHL",
                 Finished    = new DateTime(2020, 10, 1),
                 MissionName = "DHL Project2",
                 Color       = "#5B8D76",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 1
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 9, 5),
                 Description = "Project3 for DHL",
                 Finished    = new DateTime(2020, 10, 1),
                 MissionName = "DHL Project3",
                 Color       = "#5B8D76",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 1
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 8, 5),
                 Description = "Project1 for Nike",
                 Finished    = null,
                 MissionName = "Nike Project1",
                 Color       = "#E26B9D",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 2
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 9, 5),
                 Description = "Project2 for Nike",
                 Finished    = new DateTime(2020, 10, 1),
                 MissionName = "Nike Project2",
                 Color       = "#7BB6F0",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 2
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 8, 5),
                 Description = "Project3 for Nike",
                 Finished    = null,
                 MissionName = "Nike Project3",
                 Color       = "#E26B9D",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 2
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 8, 5),
                 Description = "Project1 for Ikea",
                 Finished    = null,
                 MissionName = "Project1 Ikea",
                 Color       = "#7BB6F0",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 3
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 8, 5),
                 Description = "Project2 for Ikea",
                 Finished    = null,
                 MissionName = "Project2 Ikea",
                 Color       = "#7BB6F0",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 3
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 9, 5),
                 Description = "Project1 for ICA",
                 Finished    = new DateTime(2020, 10, 1),
                 MissionName = "Project1 ICA",
                 Color       = "#F0D87B",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 4
             },
                 new Mission
             {
                 Created     = new DateTime(2020, 9, 5),
                 Description = "Project2 for ICA",
                 Finished    = new DateTime(2020, 10, 1),
                 MissionName = "Project2 ICA",
                 Color       = "#F0D87B",
                 Start       = new DateTime(2020, 8, 6),
                 Status      = 1,
                 UserId      = 1,
                 CustomerId  = 4
             }
                 );
             context.SaveChanges();
         };
     }
 }