public ActionResult ApplicantInsert( int id, JobApplicant japp, HttpPostedFileBase file1, HttpPostedFileBase file2)
        {
            ViewBag.JobPost = new JobPostClass().getJobPostByID(id);
            if (ModelState.IsValid)
            {

               //Upload the resume and cover letter of applicant in to the server
                string resume = Path.GetFileName(file1.FileName);
                string cover_letter = Path.GetFileName(file2.FileName);
                string resume_ext = Path.GetExtension(file1.FileName);
                string cover_letter_ext = Path.GetExtension(file2.FileName);
                resume = DateTime.UtcNow.Ticks + resume;
                cover_letter = DateTime.UtcNow.Ticks + cover_letter;
                japp.resume_path = resume;
                japp.cover_letter_path = cover_letter;
                if (file1 != null)
                {
                    string path = Path.Combine(Server.MapPath("~/Content/applicantInfo/resume/"), resume);
                    file1.SaveAs(path);
                }
                if (file2 != null)
                {
                    string path = Path.Combine(Server.MapPath("~/Content/applicantInfo/cover_letter/"), cover_letter);
                    file2.SaveAs(path);
                }

                japp.JobPost_id = id;
                objJobApp.commitInsert(japp);
                return RedirectToAction("Index");
            }

            return View();
        }
 //creating an instance of JobApplicant table (Model) as a parameter
 public bool commitInsert(JobApplicant japp)
 {
     //to ensure all data will be disposed of when finished
     using (objApp)
     {
         //using our model to set table columns to new values being passed and providing it to the insert command
         objApp.JobApplicants.InsertOnSubmit(japp);
         objApp.SubmitChanges();
         return true;
     }
 }
        public ActionResult ApplicantDelete(int id, JobApplicant japp)
        {
            try
            {

                // deleter resume and cover letter files of that specific applicant from server

                var resumeName = japp.resume_path;
                var coverLetterName = japp.cover_letter_path;

                string fullPath1 = Server.MapPath("~/Content/applicantInfo/resume/"
                + resumeName);

                string fullPath2 = Server.MapPath("~/Content/applicantInfo/cover_letter/"
                + coverLetterName);

                if (System.IO.File.Exists(fullPath1))
                {
                    System.IO.File.Delete(Server.MapPath("~/Content/applicantInfo/resume/"
                + resumeName));
                }
                if (System.IO.File.Exists(fullPath2))
                {
                    System.IO.File.Delete(Server.MapPath("~/Content/applicantInfo/cover_letter/"
               + coverLetterName));
                }

                // delete the information of applicant from table
                objJobApp.commitDelete(id);
                return RedirectToAction("Applicants");
            }
            catch
            {
                return View();
            }
        }
 partial void DeleteJobApplicant(JobApplicant instance);
 partial void UpdateJobApplicant(JobApplicant instance);
 partial void InsertJobApplicant(JobApplicant instance);
		private void detach_JobApplicants(JobApplicant entity)
		{
			this.SendPropertyChanging();
			entity.JobPost = null;
		}
 public ActionResult ApplicantUpdate(int id, JobApplicant japp)
 {
     //If all the input were valid , then database will be updated
     if (ModelState.IsValid)
     {
         try
         {
             objJobApp.CommitUpdate(id, japp.first_name, japp.last_name, japp.email, japp.phone, japp.status, japp.description);
             return RedirectToAction("Applicants");
         }
         catch
         {
             return View();
         }
     }
     return View();
 }