public bool AmendRegistration(ApiRegistrationModel apiRegistrationModel) { try { var incomingEntity = new ApiRegistrationTableEntity() { Password = apiRegistrationModel.Password, BaseUrl = apiRegistrationModel.BaseUrl, Username = apiRegistrationModel.Username, LicenceKey = apiRegistrationModel.LicenceKey }; _table.Execute(TableOperation.InsertOrMerge(incomingEntity)); } catch (StorageException) { return false; } return true; }
public bool SaveRegistration(ApiRegistrationModel apiModel) { _apiRegistrationRepository.AmendRegistration(apiModel); //use a simple call to verify creds try { this._cellularExtensions.GetTerminals(); } catch (CellularConnectivityException exception) { //API does not give error code for the remote name. if (exception.Message.Contains(Strings.RemoteNameNotResolved) || exception.Message == CellularInvalidCreds || exception.Message == CellularInvalidLicense) { _apiRegistrationRepository.DeleteApiDetails(); return false; } //the user may have valid creds but no devices. Which throws exception from API this is ok. } return true; }