예제 #1
0
        private void SeedProjects(Seeder <Project> seeder, ScenarioDbContext context)
        {
            if (seeder?.DefaultItems != null &&
                seeder.DefaultItems.Any())
            {
                var firstBusinessEntity = context.BusinessEntities.FirstOrDefault();
                if (firstBusinessEntity != null)
                {
                    foreach (var project in seeder.DefaultItems)
                    {
                        project.BusinessEntityId = firstBusinessEntity.Id;
                    }

                    seeder.Seed();
                }
            }
        }
예제 #2
0
        private void SeedDocuments(Seeder <Document> seeder, ScenarioDbContext context)
        {
            if (seeder?.DefaultItems != null &&
                seeder.DefaultItems.Any())
            {
                var prj01Project = context.Projects.FirstOrDefault(p => p.ProjectNo.Equals("PRJ01"));
                var memoRegister = context.Registers.FirstOrDefault(r => r.Code.Equals("MEMO"));

                if (prj01Project != null &&
                    memoRegister != null)
                {
                    foreach (var document in seeder.DefaultItems)
                    {
                        document.ProjectId  = prj01Project.Id;
                        document.RegisterId = memoRegister.Id;
                    }

                    seeder.Seed();
                }
            }
        }