diff --git a/.vscode/launch.json b/.vscode/launch.json index 388c3f8..4bc0806 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/bin/Debug/net5.0/contact.dll", + "program": "${workspaceFolder}/bin/Debug/net6.0/contact.dll", "args": [], "cwd": "${workspaceFolder}", "stopAtEntry": false, @@ -20,7 +20,7 @@ "args": "${auto-detect-url}", "windows": { "command": "cmd.exe", - "args": "/C start http://localhost:3002/contact" + "args": "/C start http://localhost:3002/request" }, "osx": { "command": "open" diff --git a/Pages/Request.cshtml.cs b/Pages/Request.cshtml.cs index 88fa290..ef519f2 100644 --- a/Pages/Request.cshtml.cs +++ b/Pages/Request.cshtml.cs @@ -97,12 +97,53 @@ namespace contact.Pages } } + PostRequestToSockeye(); SendMail(); skipspam: return Redirect("https://ayanova.com/docs/ay-evaluate/"); } + private void PostRequestToSockeye() + { + + using var client = new HttpClient(); + //client.BaseAddress = new System.Uri("https://sockeye.ayanova.com");///api/v8.0/subscription-server/ + + var r = new + { + dataCenter = SubRequest.DataCenter, + email = SubRequest.Email, + company = SubRequest.Company, + name = SubRequest.Name, + rValue = "totallylegit" + }; + + + HttpContent body = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(r), + System.Text.Encoding.UTF8, + "application/json"); + var response = client.PostAsync("https://sockeye.ayanova.com/subscription-server-trial-request", body).Result; + //var response = client.PostAsync("http://localhost:7676/subscription-server-trial-request", body).Result; + + // if (response.IsSuccessStatusCode) + // { + // var content = await response.Content.ReadAsStringAsync(); + // if (!string.IsNullOrEmpty(content)) + // { + // var objDeserializeObject = JsonConvert.DeserializeObject(content); + + // Console.WriteLine("Data Saved Successfully."); + + // if (objDeserializeObject != null) + // { + // Console.WriteLine(objDeserializeObject.Name); + // } + // } + // } + + } + private void SendMail() { diff --git a/contact.csproj b/contact.csproj index 5a4fdd6..48a82e2 100644 --- a/contact.csproj +++ b/contact.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/notes b/notes index bdad173..f81fbdb 100644 --- a/notes +++ b/notes @@ -26,4 +26,7 @@ copy up to server , then to restart the service do this: systemctl status kestrel-contact.service systemctl start kestrel-contact.service -systemctl stop kestrel-contact.service \ No newline at end of file +systemctl stop kestrel-contact.service + + + diff --git a/rest-test.http b/rest-test.http new file mode 100644 index 0000000..b4f5bb1 --- /dev/null +++ b/rest-test.http @@ -0,0 +1,11 @@ + +POST https://sockeye.ayanova.com/subscription-server-trial-request HTTP/1.1 +content-type: application/json + +{ + "dataCenter":"SubRequest.DataCenter", + "email":"SubRequest.Email", + "company":"SubRequest.Company", + "name":"SubRequest.Name", + "rValue":"totallylegit" +} \ No newline at end of file