Exemple #1
0
        private static void RentalTesst(RentalManager rentalManager, CarManager carManager)
        {
            var result = rentalManager.Add(new Rental()
            {
                CarId    = 2, ReturnDate = Convert.ToDateTime("01.01.1900"), CustomerId = 1,
                RentDate = Convert.ToDateTime("11.02.2021")
            });

            if (result.Success)
            {
                Console.WriteLine(result.Message);
            }
            else
            {
                Console.WriteLine(result.Message);
            }

            var result1 = carManager.Get(2);

            Console.WriteLine(result1.Data.Available);
            var result2 = rentalManager.FinishRental(rentalManager.Get(12).Data);

            if (result2.Success)
            {
                Console.WriteLine(result2.Message);
            }

            var result3 = rentalManager.GetRentalDetails();

            if (result3.Success)
            {
                foreach (var VARIABLE in result3.Data)
                {
                    Console.WriteLine(
                        "Rental Id:{0} Customer Id:{1} Company Name={2} Car Id:{3} Car Name:{4} Rent Date:{5} Return Date:{6}",
                        VARIABLE.RentalId, VARIABLE.CustomerId, VARIABLE.CompanyName, VARIABLE.CarId, VARIABLE.CarName,
                        VARIABLE.RentDate, VARIABLE.ReturnDate);
                }
            }
        }