Пример #1
0
 public void AddPun(Pun pun)
 {
     var lastID = this.Puns.Max(p => p.PunID);
     pun.PunID = lastID + 1;
     this.Puns.Add(pun);
     Save();
 }
Пример #2
0
        public void AddPun(Pun pun)
        {
            var lastID = this.Puns.Max(p => p.PunID);

            pun.PunID = lastID + 1;
            this.Puns.Add(pun);
            Save();
        }
Пример #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();
     }
 }
Пример #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();
            }
        }
Пример #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();
        }
Пример #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();
        }
Пример #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);
 }
Пример #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);
 }
Пример #9
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();
        }
Пример #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();
        }
Пример #11
0
 public void UpdatePun(Pun pun)
 {
     _service.UpdatePun(pun);
 }
Пример #12
0
 public void CreatePun(Pun pun)
 {
     _service.AddPun(pun);
 }
Пример #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();
        }
Пример #14
0
 public void UpdatePun(Pun pun)
 {
     throw new NotImplementedException();
 }