private void UpdateRegistrationFromWebHook(string user, WebHook webHook, Registration registration) { registration.User = user; registration.Id = webHook.Id; string content = JsonConvert.SerializeObject(webHook, _serializerSettings); string protectedData = _protector.Protect(content); registration.ProtectedData = protectedData; }
private WebHook ConvertToWebHook(Registration registration) { if (registration == null) { return null; } try { string content = _protector.Unprotect(registration.ProtectedData); WebHook webHook = JsonConvert.DeserializeObject<WebHook>(content, _serializerSettings); return webHook; } catch (Exception ex) { string msg = string.Format(CultureInfo.CurrentCulture, SqlStorageResources.SqlStore_BadWebHook, typeof(WebHook).Name, ex.Message); _logger.Error(msg, ex); } return null; }
private Registration ConvertFromWebHook(string user, WebHook webHook) { string content = JsonConvert.SerializeObject(webHook, _serializerSettings); string protectedData = _protector.Protect(content); var registration = new Registration { User = user, Id = webHook.Id, ProtectedData = protectedData }; return registration; }
private WebHook ConvertFromRegistration(Registration registration) { string content = _protector.Unprotect(registration.ProtectedData); WebHook webHook = JsonConvert.DeserializeObject<WebHook>(content, _serializerSettings); return webHook; }