private static void RentalGet() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); var result = rentalManager.Get(1).Data; Console.WriteLine("Araba Kiralama Tarihi: {0} \n Araba Teslim Tarihi: {1}", result.RentDate, result.ReturnDate); }
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); } } }
private static void RentUpdate() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); RentalList(); Console.WriteLine("Güncellemek istediğiniz verilerin Rent Id'si: "); int id = int.Parse(Console.ReadLine()); var rentalEntity = rentalManager.Get(id).Data; Console.WriteLine(rentalEntity.CarId + " " + rentalEntity.CustomerId + " " + rentalEntity.RentDate + " " + rentalEntity.ReturnDate); Console.WriteLine(""); CarList(); Console.Write("Araba Id'si güncelleyiniz: "); rentalEntity.CarId = int.Parse(Console.ReadLine()); CustomerList(); Console.Write("Müşteri Id'si güncelleyiniz: "); rentalEntity.CustomerId = int.Parse(Console.ReadLine()); Console.Write("Kiralama tarihini güncelleyiniz: "); rentalEntity.RentDate = DateTime.Parse(Console.ReadLine()); Console.Write("Teslim etme tarihini güncelleyiniz. Teslim edilmesiyse boş bırakınız: "); rentalEntity.ReturnDate = DateTime.Parse(Console.ReadLine()); rentalManager.Update(rentalEntity); }