diff --git a/Pages/Index.cshtml.cs b/Pages/Index.cshtml.cs
index aaba79f..76fac09 100644
--- a/Pages/Index.cshtml.cs
+++ b/Pages/Index.cshtml.cs
@@ -5,13 +5,13 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
namespace StateJobsNYSubmit.Pages
{
public class IndexModel : PageModel
{
private readonly ILogger _logger;
- public int counter = 1;
private PrivateData p = new PrivateData();
public IndexModel(ILogger logger)
{
@@ -20,14 +20,16 @@ namespace StateJobsNYSubmit.Pages
public void OnGet()
{
+ UserData userData = new UserData();
+ userData.visitCounter = 1;
string cookieValue = Request.Cookies["PrivateData"];
if (cookieValue != null) {
string test = p.DecryptString(cookieValue);
- counter = Int32.Parse(test);
- counter++;
+ userData = JsonConvert.DeserializeObject(test);
+ userData.visitCounter++;
}
- Response.Cookies.Append("PrivateData", p.EncryptString($"{counter}"));
- Console.WriteLine($"Value of counter: {counter}");
+ Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData)));
+ Console.WriteLine($"Value of counter: {userData.visitCounter}");
}
}
diff --git a/UserData.cs b/UserData.cs
new file mode 100644
index 0000000..26e7f37
--- /dev/null
+++ b/UserData.cs
@@ -0,0 +1,12 @@
+ // UserData myDeserializedClass = JsonConvert.DeserializeObject(myJsonResponse);
+
+ using System.Collections.Generic;
+ public class UserData
+ {
+ public string email { get; set; }
+ public string smtpHost { get; set; }
+ public List skillOptions { get; set; }
+ public string identifier { get; set; }
+ public int visitCounter { get; set;}
+ }
+