public async Task <ActionResult> DeleteExperience(int?id, int back) { if (Session["UserID"] != null) { if (Session["User_role"].ToString() != "Administrator") { return(HttpNotFound()); } ViewBag.ActiveApplicantListApplicant = "class = active"; ViewBag.ActiveTreeApplicant = "active"; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ApplicantExperience applicantexperience = await db.ApplicantExperiences.FindAsync(id); Applicant applicant = await db.Applicants.FindAsync(back); if (applicantexperience == null || applicant == null || applicantexperience.deleted != false || applicant.deleted != false || ((applicantexperience.applicant_id == applicant.applicant_id) == (applicant.deleted == true))) { return(HttpNotFound()); } return(View(applicantexperience)); } else { return(RedirectToAction("Login", "Account")); } }
public async Task <ActionResult> DeleteExperience(int id, int back) { ApplicantExperience applicantexperience = await db.ApplicantExperiences.FindAsync(id); applicantexperience.deleted = true; applicantexperience.updated_on = DateTime.Now; applicantexperience.updated_by = Session["User_firstname"].ToString() + " " + Session["User_middlename"].ToString() + " " + Session["User_lastname"].ToString(); await db.SaveChangesAsync(); TempData["t_Info"] = "deleted"; return(RedirectToAction("Details", new { id = back })); }
public async Task <ActionResult> EditExperience([Bind(Include = "e_id,updated_on,updated_by,job_title,nature,date_start,date_end,reference,number_of_hours")] ApplicantExperience applicantexperience, int back) { var currentApplicantExperience = db.ApplicantExperiences.FirstOrDefault(a => a.e_id == applicantexperience.e_id); if (currentApplicantExperience == null) { return(HttpNotFound()); } currentApplicantExperience.updated_on = DateTime.Now; currentApplicantExperience.updated_by = Session["User_firstname"].ToString() + " " + Session["User_middlename"].ToString() + " " + Session["User_lastname"].ToString(); currentApplicantExperience.job_title = applicantexperience.job_title; currentApplicantExperience.nature = applicantexperience.nature; currentApplicantExperience.date_start = applicantexperience.date_start; currentApplicantExperience.date_end = applicantexperience.date_end; currentApplicantExperience.reference = applicantexperience.reference; currentApplicantExperience.number_of_hours = applicantexperience.number_of_hours; await db.SaveChangesAsync(); TempData["t_Info"] = "updated"; return(RedirectToAction("Details", new { id = back })); }
public async Task <ActionResult> Experience([Bind(Include = "e_id,applicant_id,date_created,created_by,job_title,nature,date_start,date_end,reference,number_of_hours")] ApplicantExperience applicantexperience, int id) { if (ModelState.IsValid) { ApplicantExperience new_applicantexperience = new ApplicantExperience(); new_applicantexperience.applicant_id = id; new_applicantexperience.date_created = DateTime.Now; new_applicantexperience.created_by = Session["User_firstname"].ToString() + " " + Session["User_middlename"].ToString() + " " + Session["User_lastname"].ToString(); new_applicantexperience.job_title = applicantexperience.job_title; new_applicantexperience.nature = applicantexperience.nature; new_applicantexperience.date_start = applicantexperience.date_start; new_applicantexperience.date_end = applicantexperience.date_end; new_applicantexperience.reference = applicantexperience.reference; new_applicantexperience.number_of_hours = applicantexperience.number_of_hours; db.ApplicantExperiences.Add(new_applicantexperience); TempData["t_Info"] = "added"; await db.SaveChangesAsync(); } return(RedirectToAction("Details", new { id = id })); }