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();
        }
 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();
        }
        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
文件: Program.cs 项目: chrhodes/vnc
 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
文件: Program.cs 项目: chrhodes/vnc
 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();
        }
示例#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();
 }