public IActionResult GetPostingByName(string Name) { DatabaseInteraction dbObj = new DatabaseInteraction(); TodoJobPosting posting = dbObj.GetPostingByName(Name); return(new ObjectResult(posting)); }
public IActionResult CreateJobPosting(string JobTitle, string Company, string Location, string Description, string[] Keywords, string[][] UserAndScore) { Console.WriteLine("Inside CreateJobPosting"); string name = JobTitle; string comp = Company; string loc = Location; string descr = Description; string[] keywords = Keywords; // new string[] { "ect" };// Keywords; string[][] userAndScore = UserAndScore; //= new string[UserAndScore.Length, 2];// = UserAndScore;// new string[] { "ect" };// Keywords; DatabaseInteraction dbObj = new DatabaseInteraction(); var posting = new TodoJobPosting { JobTitle = name, Company = comp, Location = loc, Description = descr, Keywords = keywords, // keywords UserAndScore = userAndScore }; dbObj.CreateNewJobPosting(posting); return(new ObjectResult(posting)); }
//-----------------------CREATE NEW ENTRY METHODS-------------------------------------------- public void CreateNewJobPosting(TodoJobPosting posting) { posting = posting.DefaultToNone(); var coll = db.GetCollection <BsonDocument>("JobPosting"); var doc = posting.PostingToBson(); coll.InsertOne(doc); }
public IActionResult AddResumeToPosting(string Email, string JobTitle ) { DatabaseInteraction dbObj = new DatabaseInteraction(); TodoJobPosting posting = dbObj.GetPostingByName(JobTitle); TodoStudent stu = dbObj.GetUserByEmail(Email); dbObj.SubmitResumeToJob(posting, stu); return(new ObjectResult(posting)); }
public TodoJobPosting UpdatePostingInfo(string name, TodoJobPosting newPost) { //TodoStudent stu = GetUserByEmail(email); TodoJobPosting posting = GetPostingByName(name); newPost = newPost.DefaultToExisting(posting); var collection = db.GetCollection <BsonDocument>("JobPosting"); var doc = newPost.PostingToBson(); var search = new BsonDocument("JobTitle", name); BsonDocument found; found = collection.Find(search).First(); collection.ReplaceOne(found, doc); return(newPost); }
public TodoJobPosting SubmitResumeToJob(TodoJobPosting posting, TodoStudent stu) { TodoJobPosting newPosting = posting.DefaultToNone(); newPosting = newPosting.DefaultToExisting(posting); var oldUserScore = posting.UserAndScore; int oldLen = posting.UserAndScore.Length; string[][] newUserScores = new string[oldLen + 1][]; //transfer over existing submitals and appending the newest one for (int i = 0; i < oldLen; i++) { newUserScores[i] = new string[2]; string[] currComb = oldUserScore[i]; Console.WriteLine(currComb[0]); newUserScores[i][0] = currComb[0].ToString(); try { newUserScores[i][1] = currComb[1].ToString(); } catch (IndexOutOfRangeException e) { newUserScores[i][1] = "0"; } } newUserScores[oldLen] = new string[2]; newUserScores[oldLen][0] = stu.Email; int score = FileReader.ReadandAssignVal(stu.Resume, posting.Keywords); newUserScores[oldLen][1] = score.ToString(); newPosting.UserAndScore = newUserScores; var collection = db.GetCollection <BsonDocument>("JobPosting"); var newDoc = newPosting.PostingToBson(); var search = new BsonDocument("JobTitle", posting.JobTitle); BsonDocument found; try { found = collection.Find(search).First(); } catch (InvalidOperationException e) { found = new BsonDocument { { "JobTitle", "null" }, { "Company", "null" }, { "Location", "null" }, { "JobDescription", "null" }, { "Keywords", new BsonArray("") }, { "UserAndScore", new BsonArray() }, }; } collection.ReplaceOne(found, newDoc); return(newPosting); }