public static DonationContextWrapper GetContext() { var options = new DbContextOptions <DonationContext>(); var output = new DonationContextWrapper(options); output.Donations.AddRange(DonationFactory.GetDonations()); output.Categories.AddRange(CategoryFactory.GetCategories()); output.Institutions.AddRange(InstitutionFactory.GetInstitutions()); output.CategoryDonationRelations.AddRange(RelationFactory.GetRelations()); output.SaveChanges(); return(output); }
public static List <CategoriesDonationsRelation> GetRelations() { var output = new List <CategoriesDonationsRelation>(); var categories = CategoryFactory.GetCategories(); var donation = DonationFactory.GetDonations(); output.Add(new CategoriesDonationsRelation { ID = 1, //Donation = donation[0], DonationID = donation[0].ID, //Category = categories[0], CategoryID = categories[0].ID }); output.Add(new CategoriesDonationsRelation { ID = 2, //Donation = donation[0], DonationID = donation[0].ID, //Category = categories[1], CategoryID = categories[1].ID }); output.Add(new CategoriesDonationsRelation { ID = 3, //Donation = donation[0], DonationID = donation[0].ID, //Category = categories[2], CategoryID = categories[2].ID }); output.Add(new CategoriesDonationsRelation { ID = 4, //Donation = donation[1], DonationID = donation[1].ID, //Category = categories[1], CategoryID = categories[1].ID }); output.Add(new CategoriesDonationsRelation { ID = 5, //Donation = donation[1], DonationID = donation[1].ID, //Category = categories[2], CategoryID = categories[2].ID }); output.Add(new CategoriesDonationsRelation { ID = 6, //Donation = donation[1], DonationID = donation[1].ID, //Category = categories[3], CategoryID = categories[3].ID }); output.Add(new CategoriesDonationsRelation { ID = 7, //Donation = donation[2], DonationID = donation[2].ID, //Category = categories[3], CategoryID = categories[3].ID }); output.Add(new CategoriesDonationsRelation { ID = 8, //Donation = donation[2], DonationID = donation[2].ID, //Category = categories[4], CategoryID = categories[4].ID }); return(output); }