Пример #1
0
        private static void Sil(JournalListContext context)
        {
            //delete
            var s = context.Journals.Where(w => w.Name == "Journal").FirstOrDefault();

            context.Journals.Remove(s);
            context.SaveChanges();
        }
Пример #2
0
        private static void Guncelle(JournalListContext context)
        {
            //update
            var update = context.Journals.Where(w => w.Name == "Journal").FirstOrDefault();

            update.Name  = "Dergi3";
            update.Price = (decimal)15.4;
            context.SaveChanges();
        }
Пример #3
0
        private static void Ekle(JournalListContext context)
        {
            var journal = new Journal()
            {
                Name      = "Jour",
                Price     = (decimal)21.1,
                IsMonthly = true
            };

            context.Journals.Add(journal);
            context.SaveChanges();
        }
Пример #4
0
        static void Main(string[] args)
        {
            using (var context = new JournalListContext())
            {
                Ekle(context);
            }
            var journalService = InstanceFactory.Get <IJournalService>();
            var list           = journalService.GetAll();

            foreach (var j in list)
            {
                Console.WriteLine(j);
            }
            Console.WriteLine();

            //var bookManager = new JournalManager(new AdoJournalDal());
            //bookManager.GetAll().ForEach(b => Console.WriteLine(b));
            //Console.ReadLine();
            //Console.ReadKey();
        }