public Either <InstallationError, InstallationDto> GetByExternalId(long id) { return(TracedOperation.CallSync ( _logger, InstallationOperationType.GetInstallationByExternalId, id, () => _repository.FindByExternalId(id) .Map(InstallationDto.FromDomain) .ToEither(InstallationError.NotFoundByExternalId(id)) )); }
public Either <InstallationError, InstallationDto> CreateInstallation(InstallationCreateCommand command) { return(TracedOperation.CallSync ( _logger, InstallationOperationType.CreateInstallation, command, () => _repository.TrySave(command.ToDomain()) .Map(InstallationDto.FromDomain) .ToEither(InstallationError.DuplicateExternalId(command.ExternalId)) )); }
private Either <InstallationError, InstallationDto> _RunIntegration(InstallationDto installation) { var measurementIntegration = RunMeasurementIntegration(installation.ExternalId); if (measurementIntegration.IsLeft) { return(Either <InstallationError, InstallationDto> .Left <InstallationError, InstallationDto>( InstallationError.MeasurementUpdateFailed(measurementIntegration.GetLeft))); } // TODO add measurements to installation return(Either <InstallationError, InstallationDto> .Right <InstallationError, InstallationDto>( installation.WithMeasurement(measurementIntegration.Get))); }
public static InstallationError ErrorFromResponse(AirlyClientError errorResponse) => InstallationError.ClientError(errorResponse.Message);
public static InstallationViewModel Failure(InstallationError error) => new InstallationViewModel(error);
private InstallationViewModel(InstallationError error) { this._error = error; }