public void ReturnMovie(string movieTitle, string socialSecurityNumber) { //Validate SSN StaticHelp.ValidateSocialSecurityNumber(socialSecurityNumber); //Check if Customer exists Customers.CheckCustomerExsistence(socialSecurityNumber); //Check Movie var rental = Rentals.GetRentalsFor(socialSecurityNumber)?.FirstOrDefault(x => x._movieTitle.ToLower() == movieTitle.ToLower()) ?? throw new MovieDontExistsExeption("Return failed. " + ExeptionMessages.MovieDontExistsExeptionMessage); Rentals.RemoveRental(movieTitle, socialSecurityNumber); if (rental._dueDate < DateTime.Now) { throw new LateRentalExeption(ExeptionMessages.LateReturnExeptionMessage); } }
public void RentMovie(string movieTitle, string socialSecurityNumber) { StaticHelp.ValidateSocialSecurityNumber(socialSecurityNumber); ValidateRental(movieTitle, socialSecurityNumber); Rentals.AddRental(movieTitle, socialSecurityNumber); }