// 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/ public ActionResult Index(string selectedLocation = "") { var jobList = _jobRepository.GetAllJobOpportunities(); var locations = _locationRepository.GetAllLocationNames(); const string placeholderLocations = "Todas las locaciones"; locations.Insert(0, placeholderLocations); if (!String.IsNullOrEmpty(selectedLocation) && !selectedLocation.Equals(placeholderLocations)) { var locationArgument = _locationRepository.GetLocationByName(selectedLocation); jobList = _jobRepository.GetAllJobOpportunitiesByLocation(locationArgument); } if (!jobList.Any()) { return(RedirectToAction("Index", "Home")); } var vm = new JobOpportunitySearchViewModel { JobOpportunities = jobList, Locations = locations }; return(View(vm)); }
public List <RelatedJobDto> GetCompanyRelatedJobs(int id, string name, string email, string url) { var result = _jobOpportunityRepository.GetAllJobOpportunities() .Where( x => x.Id != id && (x.CompanyName == name && x.CompanyEmail == email && x.CompanyUrl == url)) .Select(jobOpportunity => new RelatedJobDto { Title = jobOpportunity.Title, Url = "/JobOpportunity/Detail/" + jobOpportunity.Id }).ToList(); return(result); }