コード例 #1
0
 private static void displayDogList(DBRepository db)
 {
     foreach (var dog in db.GetDogs())
     {
         Console.WriteLine($"{dog.Id} Namn:{dog.DogName} Födelsedag:{dog.Birthday} Ras:{dog.Breed} Kön:{dog.Gender}");
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            var aDog = new Dog()
            {
                Id = 1, DogName = "Kalle", Birthday = "2009"
            };

            var db = new DBRepository("Server=40.85.84.155;Database=SKK27;User=Student27;Password=zombie-virus@2020;");


//List all players in the db
            Console.WriteLine("Dogs from start");
            displayDogList(db);

/*
 *          //Add a players and list all players in the db
 *          Console.WriteLine("Adding a dog");
 *          db.AddDog(aDog);
 *          displayDogList(db);
 *//*
 *          //Change the players name and list all players in the db
 *          Console.WriteLine("Change dog name (but db not yet updated)");
 *          aDog.DogName = "Zlatan";
 *          displayDogList(db);
 * /*
 *          //Add update a players namn and list all players in the db
 *          Console.WriteLine("Updating a dog");
 *          db.UpdateDog(aDog);
 *          displayDogList(db);
 *
 *          //Remove a dog and list all players in the db
 *          Console.WriteLine("Removing a dog");
 *          db.RemoveDog(aDog.RegNr);
 *          displayDogList(db);
 */
        }