public async Task <LicensePlateRegistration> GetByTypeAndNumberAsync(
            string registrationType,
            string licensePlateNumber)
        {
            var table = GetCloudTable();
            LicensePlateRegistration result = null;

            var retrieveOperation = TableOperation.Retrieve <LicensePlateRegistrationEntity>(
                registrationType,
                licensePlateNumber);

            try
            {
                var retrievedResult = await table.ExecuteAsync(retrieveOperation);

                if (retrievedResult.Result != null)
                {
                    result = LicensePlateRegistrationMapper.ToLicensePlateRegistration(
                        (LicensePlateRegistrationEntity)retrievedResult.Result);
                }
            }
            catch (Exception e)
            {
                throw RepositoryExceptionBuilder.CreateExceptionForTableOperation(
                          registrationType, licensePlateNumber, table, retrieveOperation, e);
            }

            return(result);
        }
 public ConfirmParkingRequest(
     string parkingGarageName,
     LicensePlateRegistration licensePlateRegistration)
 {
     ParkingGarageName        = parkingGarageName;
     LicensePlateRegistration = licensePlateRegistration;
 }
예제 #3
0
 public ParkingOrchestrationResponse(
     LicensePlateRegistration licensePlateRegistration,
     bool gateOpened)
 {
     LicensePlateRegistration = licensePlateRegistration;
     GateOpened = gateOpened;
 }
        private static Task <ConfirmParkingResponse> ConfirmParking(
            ConfirmParkingRequest request,
            LicensePlateRegistration licensePlateRegistration,
            DurableOrchestrationContextBase context)
        {
            Task <ConfirmParkingResponse> confirmTask;

            switch (licensePlateRegistration.Type)
            {
            case LicensePlateType.Appointment:
                confirmTask = context.CallActivityAsync <ConfirmParkingResponse>(
                    nameof(ConfirmParkingForAppointment),
                    request);
                break;

            case LicensePlateType.Employee:
                confirmTask = context.CallActivityAsync <ConfirmParkingResponse>(
                    nameof(ConfirmParkingForEmployee),
                    request);
                break;

            default:
                var unknownLicencePlateResponse = ConfirmParkingResponseBuilder.BuildWithFailedUnknownLicensePlate(request.ParkingGarageName);
                confirmTask = Task.FromResult(unknownLicencePlateResponse);
                break;
            }

            return(confirmTask);
        }
 public static ParkingOrchestrationResponse Build(
     LicensePlateRegistration licensePlateRegistration,
     bool gateOpened)
 {
     return(new ParkingOrchestrationResponse(licensePlateRegistration, gateOpened));
 }
 public Task RemoveAsync(LicensePlateRegistration licenplate)
 {
     throw new NotImplementedException();
 }
 public Task AddAsync(LicensePlateRegistration licensePlateRegistration)
 {
     throw new NotImplementedException();
 }
 public static ConfirmParkingRequest Build(string parkingGarageName, LicensePlateRegistration licensePlateRegistration)
 {
     return(new ConfirmParkingRequest(parkingGarageName, licensePlateRegistration));
 }