public ActionResult Create()
 {
     ApplicantPreferredWorkLocation applicantpreferredworklocation = new ApplicantPreferredWorkLocation();
     ViewBag.PossibleApplicants = applicantRepository.All;
     ViewBag.PossibleCountries = countryRepository.All;
     ViewBag.PossibleStates = stateRepository.All;
     ViewBag.PossibleCities = cityRepository.All;
     return View(applicantpreferredworklocation);
 }
 public ActionResult Create(ApplicantPreferredWorkLocation applicantpreferredworklocation)
 {
     if (ModelState.IsValid) {
         applicantpreferredworklocationRepository.InsertOrUpdate(applicantpreferredworklocation);
         applicantpreferredworklocationRepository.Save();
         return RedirectToAction("Index");
     } else {
         ViewBag.PossibleApplicants = applicantRepository.All;
         ViewBag.PossibleCountries = countryRepository.All;
         ViewBag.PossibleStates = stateRepository.All;
         ViewBag.PossibleCities = cityRepository.All;
         return View(applicantpreferredworklocation);
     }
 }
 public ViewResult Search(ApplicantPreferredWorkLocation searchApplicantPreferredWorkLocation)
 {
     if(searchApplicantPreferredWorkLocation!=null)
     {
                     }
                 return View("Index",applicantpreferredworklocationRepository.AllIncluding(applicantpreferredworklocation => applicantpreferredworklocation.Applicant, applicantpreferredworklocation => applicantpreferredworklocation.Country, applicantpreferredworklocation => applicantpreferredworklocation.State, applicantpreferredworklocation => applicantpreferredworklocation.City));
 }
 public void InsertOrUpdate(ApplicantPreferredWorkLocation applicantpreferredworklocation)
 {
     if (applicantpreferredworklocation.ApplicantPreferredWorkLocationID == default(int)) {
         // New entity
         context.ApplicantPreferredWorkLocation.Add(applicantpreferredworklocation);
     } else {
         // Existing entity
         context.Entry(applicantpreferredworklocation).State = EntityState.Modified;
     }
 }