static void AddRabbit(Rabbit r) { using (var db = new RabbitDbContext()) { db.Rabbits.Add(r); db.SaveChanges(); } }
static void ListRabbits() { using (var db = new RabbitDbContext()) { rabbits = db.Rabbits.ToList(); } rabbits.ForEach(r => Console.WriteLine($"{r.RabbitId,-10}{r.RabbitName,-20}{r.RabbitAge}")); }
static void UpdateRabbit() { using (var db = new RabbitDbContext()) { var rabbitToUpdate = db.Rabbits.Find(1); rabbitToUpdate.RabbitName = "Molly"; db.SaveChanges(); } }