public ActionResult Edit(JobPostingViewModel model) { if (ModelState.IsValid) { var ident = System.Web.HttpContext.Current.User.Identity.Name; var comp = _companyService.GetAll(c => c.ComapanyEmail == ident).FirstOrDefault(); if (comp != null) { JobPosting posting = new JobPosting { CompanyID = comp.CompanyID, JobPostedDate = DateTime.Now.Date, JobAvailableToDate = model.JobAvailableToDate, JobTitle = model.JobTitle, JobDescription = model.JobDescription, RegionID = model.RegionID, HoursPerWeek = model.HoursPerWeek, PostID = model.PostID }; _jobPostingService.Create(posting); return(RedirectToAction("Index", "Company")); } } return(View("Edit", model)); }
public ActionResult Edit(int id) { var posting = _jobPostingService.GetAll().ToList().FirstOrDefault(x => x.PostID == id); if (posting != null) { JobPostingViewModel mappedPosting = new JobPostingViewModel(); mappedPosting = posting.ToPostingViewModel(); return(View(mappedPosting)); } return(null); }
public static JobPostingViewModel ToPostingViewModel(this JobPosting jobPosting) { JobPostingViewModel postModel = new JobPostingViewModel() { CompanyID = jobPosting.CompanyID, PostID = jobPosting.PostID, JobTitle = jobPosting.JobTitle, RegionID = jobPosting.RegionID, HoursPerWeek = jobPosting.HoursPerWeek, JobDescription = jobPosting.JobDescription, JobAvailableToDate = jobPosting.JobAvailableToDate, JobPostedDate = jobPosting.JobPostedDate }; return(postModel); }
public async Task <JobPostingViewModel> GetJobPostingById(int id) { JobPosting jobPosting = await this._context.JobPostings.FindAsync(id); if (jobPosting == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("The requested Job Posting doesn't exist in the database."), ReasonPhrase = "Missing Resource Exception" }); } JobPostingViewModel viewModel = AutoMapper.Mapper.Map <JobPostingViewModel>(jobPosting); return(viewModel); }
public ActionResult Create(JobPostingViewModel jpvm) { try { // TODO: Add insert logic here if (ModelState.IsValid) { //LOGIC HERE return(RedirectToAction("Index")); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persist, contact your system administrator."); } return(View(jpvm)); }
public ActionResult Index(string searchString, string selectedLocation) { OpenJobs[] All_Jobs = js.Get_Job_Posting_List(); IEnumerable <OpenJobs> jobList = All_Jobs.ToList(); var allUniqueLocations = jobList.Select(x => x.Job_Location).Distinct().ToList(); if (!String.IsNullOrEmpty(searchString)) { if (selectedLocation != "All Locations") { jobList = jobList.Where( x => x.Job_Location.Contains(selectedLocation) && x.Job_Title.Contains(searchString)); } if (selectedLocation == "All Locations") { jobList = jobList.Where(x => x.Job_Title.Contains(searchString)); } //jobList = jobList.Where(s => s.Job_Title.Contains(searchString) // || s.Job_Location.Contains(searchString)); } else { if (selectedLocation == null) { selectedLocation = "All Locations"; } if (selectedLocation != "All Locations") { jobList = jobList.Where(x => x.Job_Location.Contains(selectedLocation)); } } JobPostingViewModel finalModel = new JobPostingViewModel { AllJobs = jobList, Locations = allUniqueLocations }; return(View(finalModel)); }
//Not in use #region "Edit" // // GET: /PartnerPortal/JobPosting/Edit/5 public ActionResult Edit(long JobPostingID) { var model = new JobPostingViewModel(JobPostingID); return(View(model)); }
// // GET: /PartnerPortal/JobPosting/Details/5 public ActionResult Details(long jobPostingID) { var model = new JobPostingViewModel(jobPostingID); return(View(model)); }