public IActionResult New(NewJobViewModel newJobViewModel) { // TODO #6 - Validate the ViewModel and if valid, create a // new Job and add it to the JobData data store. Then // redirect to the Job detail (Index) action/view for the new Job. if (ModelState.IsValid) { var something = newJobViewModel.CreateJob(newJobViewModel); jobData.Jobs.Add(something); return(Redirect("/Job?id=" + something.ID)); } return(View(newJobViewModel)); }
public IActionResult New(NewJobViewModel newJobViewModel) { // TODO #6 - Validate the ViewModel and if valid, create a // new Job and add it to the JobData data store. Then // redirect to the Job detail (Index) action/view for the new Job. if (ModelState.IsValid) { // Add the new job to existing jobs Job newJob = newJobViewModel.CreateJob(); JobData.Jobs.Add(newJob); return(Redirect("/Job?id=" + newJob.ID)); } return(View(newJobViewModel)); }