private static void EfRentalDalTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); Rental rental1 = new Rental { CarId = 1, CustomerId = 2, RentDate = DateTime.Now, ReturnDate = null }; Rental rental2 = new Rental { CarId = 2, CustomerId = 3, RentDate = DateTime.Now, ReturnDate = null }; Console.WriteLine("\nRent records in Rentals table: "); foreach (Rental rental in rentalManager.GetAll().Data) { Console.WriteLine("Rented at {0}", rental.RentDate); } Console.WriteLine("\nTrying to rent a booked car."); rentalManager.Rent(rental1); Console.WriteLine("\nTrying to rent an avaible car."); rentalManager.Rent(rental2); Console.WriteLine("\nRent records in Rentals table: "); foreach (Rental rental in rentalManager.GetAll().Data) { Console.WriteLine("Rented at {0}", rental.RentDate); } Console.WriteLine("\nCancelling a rental."); rentalManager.Cancel(rental2); Console.WriteLine("\nRent records in Rentals table: "); foreach (Rental rental in rentalManager.GetAll().Data) { Console.WriteLine("Rented at {0}", rental.RentDate); } }
private static void WriteData(RentalManager obj) { Console.WriteLine(" rent "); foreach (var e in obj.GetAll().Data) { Console.WriteLine(e.CarId + " - " + e.CustomerId + " - " + e.RentDate + " - " + e.ReturnDate); } }
static void RentalGetAll(RentalManager rentalManager) { Console.WriteLine("\nRentals,\nId\tCarId\tCustomerId\tRentDate\t\tRetrunDate"); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine(rental.Id + "\t" + rental.CarId + "\t" + rental.CustomerId + "\t\t" + rental.RentDate + "\t" + rental.ReturnDate); } }
private static void GetAll(RentalManager rentalManager) { Console.WriteLine("**************************************************** Kiralanmış Arabalar Listesi ****************************************************"); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine("Id: " + rental.Id + " Rent Date: " + rental.RentDate + " Return Date: " + rental.ReturnDate); } }
private void RentalMenuScreen(RentalManager rentalManager, CustomerManager customerManager, CarManager carManager) { bool IsMenuOpen = true; while (IsMenuOpen) { Console.WriteLine("\n--------- ADMIN MENU ---------"); Console.WriteLine(" 1 - Add New Rental "); Console.WriteLine(" 2 - Update a Rental"); Console.WriteLine(" 3 - Delete a Rental"); Console.WriteLine(" 4 - View Rental List"); Console.WriteLine(" 5 - Go back to Main Menu"); Console.WriteLine("------------------------------"); string choice = Console.ReadLine(); if (choice == "") { Console.WriteLine("Wrong! Try again."); } else { switch (Int32.Parse(choice)) { case 1: RentalMenu_Save(rentalManager, customerManager, carManager); Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll()); break; case 2: RentalMenu_Update(rentalManager, customerManager, carManager); Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll()); break; case 3: RentalMenu_Delete(rentalManager); Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll()); break; case 4: if (rentalManager.GetCountOfAll() != 0) { Console.WriteLine("\nList of All Rentals"); rentalManager.WriteAll(rentalManager.GetAll().Data); } Console.WriteLine("Count of All Rentals: " + rentalManager.GetCountOfAll()); break; case 5: IsMenuOpen = false; break; default: Console.WriteLine("Wrong! Try again."); break; } } } }
private static void RentalManagerTest() { CarDetailDto carDetailDto = new CarDetailDto(); RentalManager rentalManager = new RentalManager(new EfRentalDal()); rentalManager.Add(new Rental { CarId = 2, CustomerId = 1, RentDate = new DateTime(2020, 06, 23) }); //rentalManager.Add(new Rental { CarId = 3, CustomerId = 3, RentDate = new DateTime(2021, 11, 26) }); var result = rentalManager.GetAll(); if (result.Success) { foreach (var rental in result.Data) { Console.WriteLine($@"{rental.CustomerId}'idli müşterimiz {rental.CarId}'idli arabayı {rental.RentDate} tarihinde kiralamıştır "); if (rental.ReturnDate != null) { Console.WriteLine($@"{rental.ReturnDate} tarihinde teslim etmiştir."); } } } Console.WriteLine("--Update--"); rentalManager.Update(new Rental { RentalId = 4, CarId = 2, CustomerId = 1, RentDate = new DateTime(2020, 06, 23), ReturnDate = new DateTime(2020, 07, 01) }); var result2 = rentalManager.GetAll(); if (result2.Success) { foreach (var rental in result2.Data) { Console.WriteLine($@"{rental.CustomerId}'idli müşterimiz {rental.CarId}'idli arabayı {rental.RentDate} tarihinde kiralamıştır "); if (rental.ReturnDate != null) { Console.WriteLine($@"{rental.ReturnDate} tarihinde teslim etmiştir."); } } } }
private static void GetRentals() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine("{0} - {1} - {2} - {3} - {4}", rental.Id, rental.CarId, rental.CustomerId, rental.RentDate, rental.ReturnDate); } }
private static void RentalGetAll() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var r in rentalManager.GetAll().Data) { Console.WriteLine(r.CarId + " " + r.UserId + " " + r.Id + " " + r.RentDate + " " + r.ReturnDate); } }
private static void RentalTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); rentalManager.Add(new Rental { CarId = 2, CustomerId = 1, RentDate = DateTime.Now, ReturnDate = new DateTime(2021, 3, 1) }); Console.WriteLine(rentalManager.GetAll().Data); }
private static void RentalGetAllTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine(rental.RentDate); } }
//private static void UserTest() //{ // UserManager userManager = new UserManager(new EfUserDal()); // foreach (var user in userManager.GetAll().Data) // { // Console.WriteLine(user.FirstName + " " + user.LastName + " " + user.Email); // } //} private static void RentalTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine(rental.RentalId + " " + rental.CustomerId + " " + rental.CarId + " " + rental.RentDate + " " + rental.ReturnDate); } }
private static void GetAllRental() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var rent in rentalManager.GetAll().Data) { Console.WriteLine(rent.Id + "/ " + rent.RentDate + "/ " + rent.ReturnDate); } }
private static void RentalManagerTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); var result = rentalManager.GetAll(); if (result.Success == true) { foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine(rental.Id + " - " + rental.CustomerId + " - " + rental.CarId + " - " + rental.RentDate + " - " + rental.ReturnDate); } } else { Console.WriteLine(result.Message); } }
private static void RentalManagerTest() { IRentalService _rentalManager = new RentalManager(new EfRentalDal()); var result = _rentalManager.GetAll(); if (result.Success == true) { foreach (var rental in _rentalManager.GetAll().Data) { Console.WriteLine(rental.ReturnDate); } } else { Console.WriteLine(result.Message); } }
private static void RentalManager() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var rent in rentalManager.GetAll().Data) { Console.WriteLine(rent.CustomerId + " " + rent.RentDate + " " + rent.ReturnDate); } //rentalManager.Add(new Rental { CustomerId = 1, RentDate = DateTime.Now, ReturnDate =new DateTime(2020,02,13) }); }
private static void RentalTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); var result = rentalManager.GetAll(); foreach (var rental in result.Data) { Console.WriteLine(rental.Id); } }
private static void RentalTest(Rental rental1) { RentalManager rentalManager = new RentalManager(new EfRentalDal()); Console.WriteLine(rentalManager.Add(rental1).Message); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine(rental.Id); } }
private static void RentalList() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var item in rentalManager.GetAll().Data) { Console.WriteLine(item.CarId + "/" + item.CustomerId + "/" + item.RentDate + "/" + item.ReturnDate); } }
private static void RentalTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine("RentalId: {0} CarID: {1} CustomerId: {2} RentDate: {3} ReturnDate: {4}" , rental.Id, rental.CarId, rental.CustomerId, rental.RentDate, rental.ReturnDate); } }
private static void RentalGetAll() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); var result = rentalManager.GetAll(); foreach (var r in result.Data) { Console.WriteLine("{0} -> {1} - {2} - {3} / {4}", r.Id, r.CustomerId, r.CarId, r.RentDate, r.ReturnDate); } }
static void Main(string[] args) { //CarCrud(); Console.WriteLine("---------------------------------------"); // ColorCrud(); Console.WriteLine("---------------------------------------"); // BrandCrud(); Console.WriteLine("---------------------------------------"); Rental rent1 = new Rental() { CarId = 1, CustomerId = 1, RentDate = DateTime.Now.Date.ToString("dd-MM-yyyy"), ReturnDate = "15-02-2021" }; RentalManager rentacar = new RentalManager(new EfRentalDal()); rentacar.Add(rent1); if (rentacar.GetAll().Success) { foreach (var rental in rentacar.GetAll().Data) { Console.WriteLine(rental.RentalId + " " + rental.RentDate + " " + rental.ReturnDate); } } else { Console.WriteLine(rentacar.GetAll().Message); } Console.WriteLine("---------------------------------------"); foreach (var car in rentacar.GetRentalDetails().Data) { Console.WriteLine("{0}-{1}-{2}-{3}-{4}-{5}", car.RentalId, car.CarName, car.CarDescription, car.RentDate, car.ReturnDate, car.TotalPrice); } }
private static void RentalAddTest(RentalManager rentalManager) { rentalManager.Add(new Rental { CarId = 1, CustomerID = 1, RentDate = DateTime.Now, ReturnDate = null }); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine(rental.CarId); } }
private static void RentalManagerTest() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); Console.WriteLine("---------Kiralık Listesi-------"); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine(rental.CustomerId); } }
private static void TestRental() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); var result = rentalManager.GetAll(); foreach (var rental in result.Data) { Console.WriteLine("{0} {1} {2}", rental.CarId, rental.CustomerId, rental.RentDate); } }
static void Main(string[] args) { RentalManager crmngr = new RentalManager(new EfRentalDal()); var result = crmngr.GetAll(); foreach (var item in result.Data) { Console.WriteLine(item.RentDate.Year + "-" + item.RentDate.Month + "-" + item.RentDate.Day); } Console.ReadKey(); }
private static void RentalsListMethod(RentalManager rentalManager) { var result = rentalManager.GetAll(); foreach (var car in result.Data) { Console.WriteLine(car.CarId + " " + "|" + " " + car.CarId + " " + "|" + " " + car.RentDate + " " + "|" + " " + car.ReturnDate); } Console.WriteLine(Messages.RentalsListed); }
private static void RentalList() { Console.WriteLine("***** KİRALAMA LİSTESİ *****\n"); RentalManager rentalManager = new RentalManager(new EfRentalDal()); //rentalManager.Add(new Rental {Id=3,CarId=2,CustomerId=2,RentDate=DateTime.Now, ReturnDate=null }); foreach (var rental in rentalManager.GetAll().Data) { Console.WriteLine("Kiralama Id : " + rental.Id + " " + "Customer Id : " + rental.CustomerId + " " + "Car Id : " + rental.CarId + " " + "Kiralama Tarihi :" + rental.RentDate + " " + "Geri geliş tarihi: " + rental.ReturnDate); } }
private static void RentalGetAll() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); var result = rentalManager.GetAll(); foreach (var rental in result.Data) { Console.WriteLine(rental.CarId + rental.RentDate.ToString()); } Console.WriteLine(result.Message); }
private static void RentalGetAll() { RentalManager rentalManager = new RentalManager(new EfRentalDal()); var result = rentalManager.GetAll(); foreach (var rent in result.Data) { Console.WriteLine("Araba Kiralama Tarihi: {0} \n Araba Teslim Tarihi: {1}", rent.RentDate, rent.ReturnDate); Console.WriteLine("---------------------------------"); } }
}//Metodlar private static void RentalGetAll(RentalManager rentalManagerEF) { var result = rentalManagerEF.GetAll(); if (result.Success) { foreach (var rental in result.Data) { Console.WriteLine(rental.RentDate); } } }