예제 #1
0
        // GET: /JobOpportunity/Detail/4
        public ActionResult Detail(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Index"));
            }

            var vm = _jobRepository.GetJobOpportunityById(id);

            if (vm != null)
            {
                var relatedJobs =
                    _jobRepository.GetAllJobOpportunities()
                    .Where(
                        x =>
                        x.Id != vm.Id &&
                        (x.CompanyName == vm.CompanyName && x.CompanyEmail == vm.CompanyEmail &&
                         x.CompanyUrl == vm.CompanyUrl)).Select(jobOpportunity => new RelatedJobDto()
                {
                    Title = jobOpportunity.Title,
                    Url   = "/JobOpportunity/Detail/" + jobOpportunity.Id
                }).ToList();

                ViewBag.RelatedJobs = relatedJobs;

                return(View("Detail", vm));
            }


            ViewBag.ErrorMessage =
                "La vacante solicitada no existe. Por favor escoger una vacante válida del listado";

            return(View("Index"));
        }
        // GET: /JobOpportunity/Detail/4
        public ActionResult Detail(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Index"));
            }

            var vm = _jobRepository.GetJobOpportunityById(id);

            if (vm != null)
            {
                return(View("Detail", vm));
            }

            ViewBag.ErrorMessage =
                "La vacante solicitada no existe. Por favor escoger una vacante válida del listado";

            return(View("Index"));
        }
예제 #3
0
 public JobOpportunity GetJobOpportunityById(int?id)
 {
     return(_jobOpportunityRepository.GetJobOpportunityById(id));
 }