public ResourcePoolRepository getResourcePoolRepository() { if (resourcePoolRepository == null) { resourcePoolRepository = new ResourcePoolRepository(); } return(resourcePoolRepository); }
static void CreateSampleUser(WealthEconomyContext context) { // Managers & stores & repositories var userStore = new UserStore(context); userStore.AutoSaveChanges = true; var userManager = new UserManager <User, int>(userStore); var resourcePoolRepository = new ResourcePoolRepository(context); // Sample user var sampleUserName = "******"; var sampleEmail = "*****@*****.**"; var sampleUser = userManager.FindByEmail(sampleEmail); if (sampleUser == null) { sampleUser = new User(sampleUserName, sampleEmail); var sampleUserPassword = DateTime.Now.ToString("yyyyMMdd"); userManager.Create(sampleUser, sampleUserPassword); } // Save context.SaveChanges(); // Login as (required in order to save the rest of the items) Security.LoginAs(sampleUser.Id); // Sample resource pools var billionDollarQuestion = resourcePoolRepository.CreateBillionDollarQuestion(sampleUser); var upoSample = resourcePoolRepository.CreateUPOSample(sampleUser); var basicsExistingSystemSample = resourcePoolRepository.CreateBasicsExistingSystemSample(sampleUser); var basicsNewSystemSample = resourcePoolRepository.CreateBasicsNewSystemSample(sampleUser); var priorityIndexSample = resourcePoolRepository.CreatePriorityIndexSample(sampleUser); var knowledgeIndexSample = resourcePoolRepository.CreateKnowledgeIndexSample(sampleUser); var knowledgeIndexPopularSoftwareLicenseSample = resourcePoolRepository.CreateKnowledgeIndexPopularSoftwareLicenseSample(sampleUser); var totalCostIndexExistingSystemSample = resourcePoolRepository.CreateTotalCostIndexExistingSystemSample(sampleUser); var totalCostIndexNewSystemSample = resourcePoolRepository.CreateTotalCostIndexNewSystemSample(sampleUser); var allInOneSample = resourcePoolRepository.CreateAllInOneSample(sampleUser); // Set Id fields explicitly, since strangely EF doesn't save them in the order that they've been added to ResourcePoolSet. // And they're referred with these Ids on front-end samples billionDollarQuestion.Id = 1; upoSample.Id = 8; basicsExistingSystemSample.Id = 9; basicsNewSystemSample.Id = 10; priorityIndexSample.Id = 2; knowledgeIndexSample.Id = 3; knowledgeIndexPopularSoftwareLicenseSample.Id = 4; totalCostIndexExistingSystemSample.Id = 5; totalCostIndexNewSystemSample.Id = 6; allInOneSample.Id = 7; // Insert resourcePoolRepository.Insert(billionDollarQuestion); resourcePoolRepository.Insert(upoSample); resourcePoolRepository.Insert(basicsExistingSystemSample); resourcePoolRepository.Insert(basicsNewSystemSample); resourcePoolRepository.Insert(priorityIndexSample); resourcePoolRepository.Insert(knowledgeIndexSample); resourcePoolRepository.Insert(knowledgeIndexPopularSoftwareLicenseSample); resourcePoolRepository.Insert(totalCostIndexExistingSystemSample); resourcePoolRepository.Insert(totalCostIndexNewSystemSample); resourcePoolRepository.Insert(allInOneSample); // First save context.SaveChanges(); }
void CreateNewStore() { resourcePoolRepository = new ResourcePoolRepository(Context); }
void CreateNewStore() { resourcePoolRepository = new ResourcePoolRepository(Context); userResourcePoolRepository = new UserResourcePoolRepository(Context); }