Exemplo n.º 1
0
        // The detail display for a given Job at URLs like /Job?id=17
        public IActionResult Index(int id)
        {
            // TODO #1 - get the Job with the given ID and pass it into the view]

            SearchJobsViewModel jobsViewModel = new SearchJobsViewModel();

            TechJobs.Models.Job jobInfo = new TechJobs.Models.Job(); //Unclear if this is necessary.
            jobInfo            = jobData.Find(id);
            jobsViewModel.Jobs = new List();                         //Initialize the Jobs list. This appears to solve the null issue.
            jobsViewModel.Jobs.Add(jobInfo);                         //System.NullReferenceException: 'Object reference not set to an instance of an object.'
                                                                     //TechJobs.ViewModels.SearchJobsViewModel.Jobs.get returned null.
            jobsViewModel.Title = "Job";


            return(View(jobsViewModel));
        }
Exemplo n.º 2
0
 // The detail display for a given Job at URLs like /Job?id=17
 public IActionResult Index(int id)
 {
     // TODO #1 - get the Job with the given ID and pass it into the view
     TechJobs.Models.Job someJob = jobData.Find(id);
     return(View(someJob));
 }