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(); } }
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 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); }
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(); }
public void UpdatePun(Pun pun) { _service.UpdatePun(pun); }
public void CreatePun(Pun pun) { _service.AddPun(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); 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(); }
public void UpdatePun(Pun pun) { throw new NotImplementedException(); }