static void UpdateRabbit(int ID) { //var randomRabbitName = Console.ReadLine(); using (var db = new RabbitDbContext()) { var updateRabbit = db.Rabbits.Find(ID); updateRabbit.RabbitAge += 1; db.Rabbits.Update(updateRabbit); db.SaveChanges(); } }
static Rabbit AddRabbit() { Random rand = new Random(); var randomRabbitName = GenerateRandomRabbitName(); var newRabbit = new Rabbit() { RabbitName = randomRabbitName, RabbitAge = 0 }; using (var db = new RabbitDbContext()) { db.Rabbits.Add(newRabbit); db.SaveChanges(); } return(newRabbit); }