|
|
@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Threading.Tasks; |
|
|
@ -14,24 +15,43 @@ namespace StateJobsNYSubmit.Pages |
|
|
|
private readonly ILogger<IndexModel> _logger; |
|
|
|
private readonly ILogger<IndexModel> _logger; |
|
|
|
private PrivateData p = new PrivateData(); |
|
|
|
private PrivateData p = new PrivateData(); |
|
|
|
public UserData userData; |
|
|
|
public UserData userData; |
|
|
|
|
|
|
|
public string Posting_ID {get; set;} |
|
|
|
public IndexModel(ILogger<IndexModel> logger) |
|
|
|
public IndexModel(ILogger<IndexModel> logger) |
|
|
|
{ |
|
|
|
{ |
|
|
|
_logger = logger; |
|
|
|
_logger = logger; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void OnGet() |
|
|
|
|
|
|
|
|
|
|
|
public void GetUserData() |
|
|
|
{ |
|
|
|
{ |
|
|
|
userData = new UserData(); |
|
|
|
userData = new UserData(); |
|
|
|
userData.skillOptions = new List<string>(); |
|
|
|
userData.skillOptions = new List<string>(); |
|
|
|
userData.visitCounter = 1; |
|
|
|
userData.visitCounter = 1; |
|
|
|
string cookieValue = Request.Cookies["PrivateData"]; |
|
|
|
string cookieValue = Request.Cookies["PrivateData"]; |
|
|
|
if (cookieValue != null) { |
|
|
|
if (cookieValue != null) |
|
|
|
|
|
|
|
{ |
|
|
|
string test = p.DecryptString(cookieValue); |
|
|
|
string test = p.DecryptString(cookieValue); |
|
|
|
userData = JsonConvert.DeserializeObject<UserData>(test); |
|
|
|
userData = JsonConvert.DeserializeObject<UserData>(test); |
|
|
|
userData.visitCounter++; |
|
|
|
userData.visitCounter++; |
|
|
|
} |
|
|
|
} |
|
|
|
Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData))); |
|
|
|
Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData))); |
|
|
|
Console.WriteLine($"Value of counter: {userData.visitCounter}"); |
|
|
|
Console.WriteLine($"Value of counter: {userData.visitCounter}"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void OnGet() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GetUserData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void OnPost() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
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 p = new Posting(vacancyID); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Console.WriteLine($"Unable to get Posting ID from form."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|