private static void ListPublishers(Pubs pubs) { foreach (Publisher publisher in pubs.Publishers) { Console.WriteLine(publisher); } }
private static void TitlePriceRise(decimal percentageRise) { using (var pubs = new Pubs()) { pubs.ApplyPercentagePriceChangeToTitle(percentageRise); } ListPublishersAndTitles(); }
static void Main(string[] args) { using (var pubs = new Pubs()) { //ListPublishers(pubs); ListPublishersAndTitles(pubs); } }
private static void ListPublishers() { using (var pubs = new Pubs()) { foreach (Publisher publisher in pubs.Publishers) { Console.WriteLine(publisher); } } }
static void Main(string[] args) { using (var pubs = new Pubs()) { foreach (Publisher publisher in pubs.Publishers) { Console.WriteLine(publisher); } } }
private static void ListPublishersAndTitles(Pubs pubs) { pubs.Configuration.LazyLoadingEnabled = false; foreach (Publisher publisher in pubs.Publishers.Include(p => p.Titles)) { Console.WriteLine(publisher); foreach (Title title in publisher.Titles) { Console.WriteLine("\t{0} @ {1:C}", title.Name, title.Price); } } }
static void Main(string[] args) { Pubs pubs = new Pubs(); using (pubs) { foreach (Publisher pub in pubs.Publishers) { Console.WriteLine(pub); } Console.ReadLine(); } }
private static void TitlePriceRise(decimal percentageRise) { using (var pubs = new Pubs()) { foreach (Title title in pubs.Titles) { title.Price *= 1 + percentageRise; } pubs.SaveChanges(); } ListPublishersAndTitles(); }