public async Task <ActionResult> DeleteEducationalBackground(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)); } ApplicantEducationalBackground applicanteducationalbackground = await db.ApplicantEducationalBackgrounds.FindAsync(id); Applicant applicant = await db.Applicants.FindAsync(back); if (applicanteducationalbackground == null || applicant == null || applicanteducationalbackground.deleted != false || applicant.deleted != false || ((applicanteducationalbackground.applicant_id == applicant.applicant_id) == (applicant.deleted == true))) { return(HttpNotFound()); } return(View(applicanteducationalbackground)); } else { return(RedirectToAction("Login", "Account")); } }
public async Task <ActionResult> DeleteEducationalBackground(int id, int back) { ApplicantEducationalBackground applicanteducationalbackground = await db.ApplicantEducationalBackgrounds.FindAsync(id); applicanteducationalbackground.deleted = true; applicanteducationalbackground.updated_on = DateTime.Now; applicanteducationalbackground.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> EditEducationalBackground([Bind(Include = "eb_id,updated_on,updated_by,school,school_level,year_graduated,honors")] ApplicantEducationalBackground applicanteducationalbackground, int back) { var currentApplicantEducationalBackground = db.ApplicantEducationalBackgrounds.FirstOrDefault(a => a.eb_id == applicanteducationalbackground.eb_id); if (currentApplicantEducationalBackground == null) { return(HttpNotFound()); } currentApplicantEducationalBackground.updated_on = DateTime.Now; currentApplicantEducationalBackground.updated_by = Session["User_firstname"].ToString() + " " + Session["User_middlename"].ToString() + " " + Session["User_lastname"].ToString(); currentApplicantEducationalBackground.school = applicanteducationalbackground.school; currentApplicantEducationalBackground.school_level = applicanteducationalbackground.school_level; currentApplicantEducationalBackground.year_graduated = applicanteducationalbackground.year_graduated; currentApplicantEducationalBackground.honors = applicanteducationalbackground.honors; await db.SaveChangesAsync(); TempData["t_Info"] = "updated"; return(RedirectToAction("Details", new { id = back })); }
public async Task <ActionResult> EducationalBackground([Bind(Include = "eb_id,applicant_id,date_created,created_by,school,school_level,year_graduated,honors")] ApplicantEducationalBackground applicanteducationalbackground, int id) { if (ModelState.IsValid) { ApplicantEducationalBackground new_applicanteducationalbackground = new ApplicantEducationalBackground(); new_applicanteducationalbackground.applicant_id = id; new_applicanteducationalbackground.date_created = DateTime.Now; new_applicanteducationalbackground.created_by = Session["User_firstname"].ToString() + " " + Session["User_middlename"].ToString() + " " + Session["User_lastname"].ToString(); new_applicanteducationalbackground.school = applicanteducationalbackground.school; new_applicanteducationalbackground.school_level = applicanteducationalbackground.school_level; new_applicanteducationalbackground.year_graduated = applicanteducationalbackground.year_graduated; new_applicanteducationalbackground.honors = applicanteducationalbackground.honors; db.ApplicantEducationalBackgrounds.Add(new_applicanteducationalbackground); await db.SaveChangesAsync(); } TempData["t_Info"] = "added"; return(RedirectToAction("Details", new { id = id })); }