Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.6 kB
0
Indexable
Never
using GarageDataAccess.DataAccess;
using GarageDataAccess.Models;


Console.WriteLine("-------- Detta är ditt garage --------");
Console.WriteLine("1. Lägg till en ny bil");
Console.WriteLine("2. Kontrollera vilka bilar som finns");
Console.WriteLine("3. Uppdatera garaget");
Console.WriteLine("4. Ta bort en bil");



MongoDataAccess db = new MongoDataAccess();
int customerChoice = db.InputControl();



switch (customerChoice)
{
    case 1:
        Console.WriteLine("Ange bilmärkte och färg");
        string brand = Console.ReadLine();
        string colour = Console.ReadLine();



        var CarModel = new CarModel { Brand = brand, Colour = colour };
        await db.CreateCar(CarModel);
        //Insert  



        break;



    case 2:
        var carCollection = await db.GetAllCars();
        foreach (var cars in carCollection)
        {
            Console.WriteLine(cars.Brand);
        }

        break;

    case 3:
        var carCollection = await db.UpdateCar(car Car);
        foreach (var cars in carCollection)
        {
            Console.WriteLine(cars.Brand);
            Console.WriteLine(cars.Colour);
        }

        break;
    case 4:
        var carCollection = await db.GetAllCars();
        foreach (var cars in carCollection)
        {
            Console.WriteLine(cars.Brand);
        }

        break;

    defult:
        var carCollection = await db.GetAllCars();
        foreach (var cars in carCollection)
        {
            Console.WriteLine(cars.Brand);
        }

        break;

}



//Find