예제 #1
0
        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);
        }
예제 #2
0
        public async Task <IActionResult> Index()
        {
            var databaseRecords = await _parkingManager.GetAllParkingSpaces();

            var model = PopulateIndexModelWithDatabaseRecods(databaseRecords);

            return(View(model));
        }