internal void SaveCreatedAdvert(Advert advert) { _readModel.Adverts.Add(advert); _readModel.Advertisers.Attach(advert.Advertiser); _readModel.CatchTypes.Attach(advert.CatchType); _readModel.SaveChanges(); }
private static void AddAdvertisers(AdvertisingDbContext context) { if (context.Advertisers.Count() == 0) { context.Advertisers.Add(new Advertiser(1, "Nina")); context.Advertisers.Add(new Advertiser(2, "Fred")); context.SaveChanges(); } }
private static void AddCatchTypes(AdvertisingDbContext context) { if (context.CatchTypes.Count() == 0) { context.CatchTypes.Add(new CatchType(1, "Lobster")); context.CatchTypes.Add(new CatchType(2, "Cod")); context.CatchTypes.Add(new CatchType(3, "Halibut")); context.SaveChanges(); } }