Exemplo n.º 1
0
 private static void ListPublishers(Pubs pubs)
 {
     foreach (Publisher publisher in pubs.Publishers)
     {
         Console.WriteLine(publisher);
     }
 }
Exemplo n.º 2
0
 private static void TitlePriceRise(decimal percentageRise)
 {
     using (var pubs = new Pubs())
     {
         pubs.ApplyPercentagePriceChangeToTitle(percentageRise);
     }
     ListPublishersAndTitles();
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            using (var pubs = new Pubs())
            {
                //ListPublishers(pubs);

                ListPublishersAndTitles(pubs);
            }
        }
Exemplo n.º 4
0
 private static void ListPublishers()
 {
     using (var pubs = new Pubs())
     {
         foreach (Publisher publisher in pubs.Publishers)
         {
             Console.WriteLine(publisher);
         }
     }
 }
Exemplo n.º 5
0
 static void Main(string[] args)
 {
     using (var pubs = new Pubs())
     {
         foreach (Publisher publisher in pubs.Publishers)
         {
             Console.WriteLine(publisher);
         }
     }
 }
Exemplo n.º 6
0
        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);
                }
            }
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Pubs pubs = new Pubs();

            using (pubs)
            {
                foreach (Publisher pub in pubs.Publishers)
                {
                    Console.WriteLine(pub);
                }
                Console.ReadLine();
            }
        }
Exemplo n.º 8
0
        private static void TitlePriceRise(decimal percentageRise)
        {
            using (var pubs = new Pubs())
            {
                foreach (Title title in pubs.Titles)
                {
                    title.Price *= 1 + percentageRise;
                }

                pubs.SaveChanges();
            }

            ListPublishersAndTitles();
        }