Esempio n. 1
0
 public void AddPun(Pun pun)
 {
     var lastID = this.Puns.Max(p => p.PunID);
     pun.PunID = lastID + 1;
     this.Puns.Add(pun);
     Save();
 }
Esempio n. 2
0
        public void AddPun(Pun pun)
        {
            var lastID = this.Puns.Max(p => p.PunID);

            pun.PunID = lastID + 1;
            this.Puns.Add(pun);
            Save();
        }
Esempio n. 3
0
 public void UpdatePun(Pun pun)
 {
     var found = this.Puns.SingleOrDefault(p => p.PunID == pun.PunID);
     if (found != null)
     {
         this.Puns.Remove(found);
         this.Puns.Add(pun);
         Save();
     }
 }
Esempio n. 4
0
        public void UpdatePun(Pun pun)
        {
            var found = this.Puns.SingleOrDefault(p => p.PunID == pun.PunID);

            if (found != null)
            {
                this.Puns.Remove(found);
                this.Puns.Add(pun);
                Save();
            }
        }
Esempio n. 5
0
        private void SeedPuns()
        {
            var pun = new Pun
            {
                PunID = 1,
                Title = "Lazy Bike",
                Joke  = "Why can't a bike stand up on its own?  It's two tired!"
            };

            this.Puns.Add(pun);
            Save();
        }
Esempio n. 6
0
        private void SeedPuns()
        {
            var pun = new Pun
            {
                PunID = 1,
                Title = "Lazy Bike",
                Joke = "Why can't a bike stand up on its own?  It's two tired!"
            };

            this.Puns.Add(pun);
            Save();
        }
Esempio n. 7
0
 private static void EnterPun()
 {
     Console.WriteLine("---------------");
     Console.Write("Name of pun? ");
     var name = Console.ReadLine();
     Console.Write("Pun? ");
     var joke = Console.ReadLine();
     var pun = new Pun
     {
         Title = name,
         Joke = joke
     };
     _service.CreatePun(pun);
 }
Esempio n. 8
0
 private static void EditPun(int index)
 {
     Console.WriteLine("---------------");
     Console.Write("Name of pun? ");
     var name = Console.ReadLine();
     Console.Write("Pun? ");
     var joke = Console.ReadLine();
     var pun = new Pun
     {
         PunID = index,
         Title = name,
         Joke = joke
     };
     _service.UpdatePun(pun);
 }
        private void SeedPuns()
        {
            var pun = new Pun
            {
                PunID = 1,
                Title = "Lazy Bike",
                Joke = "Why can't a bike stand up on its own?  It's two tired!"
            };
            this.Puns.Add(pun);

            pun = new Pun
            {
                PunID = 2,
                Title = "Cheap Batteries",
                Joke = "How much for the dead batteries? Nothing - they're free of charge!"
            };
            this.Puns.Add(pun);
            Save();
        }
Esempio n. 10
0
        private void SeedPuns()
        {
            var pun = new Pun
            {
                PunID = 1,
                Title = "Lazy Bike",
                Joke  = "Why can't a bike stand up on its own?  It's two tired!"
            };

            this.Puns.Add(pun);

            pun = new Pun
            {
                PunID = 2,
                Title = "Cheap Batteries",
                Joke  = "How much for the dead batteries? Nothing - they're free of charge!"
            };
            this.Puns.Add(pun);
            Save();
        }
Esempio n. 11
0
 public void UpdatePun(Pun pun)
 {
     _service.UpdatePun(pun);
 }
Esempio n. 12
0
 public void CreatePun(Pun pun)
 {
     _service.AddPun(pun);
 }
Esempio n. 13
0
        private void SeedPuns()
        {
            var pun = new Pun
            {
                PunID = 1,
                Title = "Lazy Bike",
                Joke = "Why can't a bike stand up on its own?  It's two tired!"
            };

            this.Puns.Add(pun);
            this.Puns.Add(new Pun
                {
                    PunID = 2,
                    Title = "Catch!",
                    Joke = "I wondered why the baseball was getting bigger.  Then it hit me."
                });

            this.Puns.Add(new Pun
                {
                    PunID = 3,
                    Title = "Right Handed",
                    Joke = "Did you hear about the guy who got his left side cut off?  He's all right now!"
                });

            this.Puns.Add(new Pun
                {
                    PunID = 4,
                    Title = "Best Seller",
                    Joke = "I'm reading a book about anti-gravity.  It's impossible to put down!"
                });
            Save();
        }
Esempio n. 14
0
 public void UpdatePun(Pun pun)
 {
     throw new NotImplementedException();
 }