Get Post_ID working

This commit is contained in:
2021-08-02 15:41:47 -04:00
parent bd4d34fa2a
commit cc6928b67a
2 changed files with 70 additions and 50 deletions

View File

@ -11,14 +11,12 @@
<h6>Start Here</h6>
</div>
<div class="card-body">
<form id="job_application" method="post">
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="posting_id">Vacancy ID: </label>
<input type="text" id="posting_id" class="form-control" />
<input asp-for="Posting_ID" type="text" id="posting_id" class="form-control" />
<small id="postingHelp" class="form-text text-muted">You can get this from the URL or from
the
vacancy
review. This is NOT the Box #.</small>
the vacancy review. This is NOT the Box #.</small>
</div>
<div class="form-group">
<h6>Skills for Cover Letter</h6>
@ -45,10 +43,12 @@
</div>
<div class="card-body">
<p>Cover Letter</p>
<textarea style="width: 100%" name="cover_letter">Nothing yet, this is where the Cover Letter would go!</textarea>
<textarea style="width: 100%"
name="cover_letter">Nothing yet, this is where the Cover Letter would go!</textarea>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-secondary">Submit</button> <button type="submit" class="btn btn-secondary">Download</button>
<button type="submit" class="btn btn-secondary">Submit</button> <button type="submit"
class="btn btn-secondary">Download</button>
</div>
</div>

View File

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