|
|
@ -12,6 +12,7 @@ namespace StateJobsNYSubmit.Pages |
|
|
|
private PrivateData p = new PrivateData(); |
|
|
|
private PrivateData p = new PrivateData(); |
|
|
|
public UserData userData; |
|
|
|
public UserData userData; |
|
|
|
public string Posting_ID {get; set;} |
|
|
|
public string Posting_ID {get; set;} |
|
|
|
|
|
|
|
public string CoverLetter {get; set;} |
|
|
|
public Posting posting = null; |
|
|
|
public Posting posting = null; |
|
|
|
public IndexModel(ILogger<IndexModel> logger) |
|
|
|
public IndexModel(ILogger<IndexModel> logger) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -30,9 +31,8 @@ namespace StateJobsNYSubmit.Pages |
|
|
|
string test = p.DecryptString(cookieValue); |
|
|
|
string test = p.DecryptString(cookieValue); |
|
|
|
userData = JsonConvert.DeserializeObject<UserData>(test); |
|
|
|
userData = JsonConvert.DeserializeObject<UserData>(test); |
|
|
|
userData.visitCounter++; |
|
|
|
userData.visitCounter++; |
|
|
|
|
|
|
|
this.CoverLetter = userData.coverLetter; |
|
|
|
} |
|
|
|
} |
|
|
|
Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData))); |
|
|
|
|
|
|
|
Console.WriteLine($"Value of counter: {userData.visitCounter}"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
public void OnGet(string vacancyID) |
|
|
|
public void OnGet(string vacancyID) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -40,22 +40,26 @@ namespace StateJobsNYSubmit.Pages |
|
|
|
if (vacancyID != null && !vacancyID.Trim().Equals("")) { |
|
|
|
if (vacancyID != null && !vacancyID.Trim().Equals("")) { |
|
|
|
posting = new Posting(vacancyID); |
|
|
|
posting = new Posting(vacancyID); |
|
|
|
this.Posting_ID = vacancyID; |
|
|
|
this.Posting_ID = vacancyID; |
|
|
|
} else { |
|
|
|
this.CoverLetter = userData.coverLetter; |
|
|
|
Console.WriteLine($"Unable to get Posting ID from Get Request URL."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData))); |
|
|
|
} |
|
|
|
} |
|
|
|
public void OnPost() |
|
|
|
public void OnPost() |
|
|
|
{ |
|
|
|
{ |
|
|
|
GetUserData(); |
|
|
|
GetUserData(); |
|
|
|
string vacancyID = Request.Form["posting_id"]; |
|
|
|
string vacancyID = Request.Form["posting_id"]; |
|
|
|
|
|
|
|
string coverLetterFormat = Request.Form["CoverLetter"]; |
|
|
|
|
|
|
|
userData.coverLetter = coverLetterFormat; |
|
|
|
if (vacancyID != null && !vacancyID.Trim().Equals("")) { |
|
|
|
if (vacancyID != null && !vacancyID.Trim().Equals("")) { |
|
|
|
posting = new Posting(vacancyID); |
|
|
|
posting = new Posting(vacancyID); |
|
|
|
|
|
|
|
this.CoverLetter = posting.GenerateLetter(coverLetterFormat); |
|
|
|
|
|
|
|
this.Posting_ID = vacancyID; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Console.WriteLine($"Unable to get Posting ID from form."); |
|
|
|
Console.WriteLine($"Unable to get Posting ID from form."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Response.Cookies.Append("PrivateData", p.EncryptString(JsonConvert.SerializeObject(userData))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|