public async Task CreateNextParkingDaysIfNeccesary(int daysToAddInAdvance, IParking parkingManager, IParkingDetailsOnDate parkingDetailsManager, IParkingManagement parkingManagementManager) { await AssignClassVariables(daysToAddInAdvance, parkingManager, parkingDetailsManager, parkingManagementManager); var LastExistingDateInTheDB = await _parkingDetailsManager.GetLastExistingDate(); var allNeededDaysExist = await CheckIfAllNeededDaysExist(LastExistingDateInTheDB); if (allNeededDaysExist) { return; } var isThereAnyMissingDate = await _parkingManager.GetAllParkingSpacesWithMissingDate(LastExistingDateInTheDB.AddBusinessDays(this.daysToAddInAdvance).Date, false); var numberOfPArkingSpaces = await _parkingManager.GetAllParkingSpaces(); if (isThereAnyMissingDate.Count() == numberOfPArkingSpaces.Count()) { return; } var numberOfDaysToCheck = await GetTotalNumberOfDaysToCheck(LastExistingDateInTheDB); await CheckIfRecordExistIOnDateAndCreateIfNot(numberOfDaysToCheck); }
public async Task <IActionResult> Index() { var databaseRecords = await _parkingManager.GetAllParkingSpaces(); var model = PopulateIndexModelWithDatabaseRecods(databaseRecords); return(View(model)); }