diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs
index c756b07..b0c868c 100644
--- a/Pages/Index.cshtml.cs
+++ b/Pages/Index.cshtml.cs
@@ -1,9 +1,5 @@
using System;
-using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
@@ -38,9 +34,16 @@ namespace StateJobsNYSubmit.Pages
Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData)));
Console.WriteLine($"Value of counter: {userData.visitCounter}");
}
- public void OnGet()
+ public void OnGet(string vacancyID)
{
GetUserData();
+ if (vacancyID != null && !vacancyID.Trim().Equals("")) {
+ posting = new Posting(vacancyID);
+ this.Posting_ID = vacancyID;
+ } else {
+ Console.WriteLine($"Unable to get Posting ID from Get Request URL.");
+ }
+
}
public void OnPost()
@@ -48,7 +51,6 @@ namespace StateJobsNYSubmit.Pages
GetUserData();
string vacancyID = Request.Form["posting_id"];
if (vacancyID != null && !vacancyID.Trim().Equals("")) {
- Console.WriteLine($"Value of not null or empty vacancy ID: {vacancyID}");
posting = new Posting(vacancyID);
} else {
Console.WriteLine($"Unable to get Posting ID from form.");
diff --git a/Pages/Settings.cshtml.cs b/Pages/Settings.cshtml.cs
index e0277dd..52d3e88 100644
--- a/Pages/Settings.cshtml.cs
+++ b/Pages/Settings.cshtml.cs
@@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
namespace StateJobsNYSubmit.Pages
{
@@ -12,11 +10,27 @@ namespace StateJobsNYSubmit.Pages
{
private readonly ILogger _logger;
+ private PrivateData p = new PrivateData();
+ public UserData userData;
public SettingsModel(ILogger logger)
{
_logger = logger;
}
-
+ public void GetUserData()
+ {
+ userData = new UserData();
+ userData.skillOptions = new List();
+ userData.visitCounter = 1;
+ string cookieValue = Request.Cookies["PrivateData"];
+ if (cookieValue != null)
+ {
+ string test = p.DecryptString(cookieValue);
+ userData = JsonConvert.DeserializeObject(test);
+ userData.visitCounter++;
+ }
+ Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData)));
+ Console.WriteLine($"Value of counter: {userData.visitCounter}");
+ }
public void OnGet()
{
}
diff --git a/PrivateData.cs b/PrivateData.cs
index 6979d4a..d5e4642 100644
--- a/PrivateData.cs
+++ b/PrivateData.cs
@@ -32,7 +32,6 @@ class PrivateData
{
try
{
- Console.WriteLine(RSAKey.ToString());
byte[] encryptedData;
encryptedData = RSA.Encrypt(Data, DoOAEPPadding);