public IActionResult Index() { var filteredJobsByUserProfile = _jobsService.GetByUser(_currentUser.UserId); //var filteredCompaniesByUserProfile = _companiesService.GetByUserId(_currentUser.UserId); var filteredCompaniesByUserProfile = _companiesService.GetByUserId(_currentUser.UserId); var viewModel = new UserProfileViewModel { Jobs = filteredJobsByUserProfile, Companies = filteredCompaniesByUserProfile }; return(View(viewModel)); }
public IActionResult Wizard(int?id) { var model = new WizardViewModel { Categories = _categoriesService.GetAll(), JobTypes = _hiretypesService.GetAll(), Companies = _companiesService.GetByUserId(_currentUser.UserId) }; if (id.HasValue) { var originalJob = _jobsService.GetById(id.Value); if (originalJob.UserId == _currentUser.UserId) { model.Id = originalJob.Id; model.CompanyId = originalJob.Company.Id; model.CreateNewCompany = false; model.Title = originalJob.Title; model.Description = originalJob.Description; model.HowToApply = originalJob.HowToApply; model.CategoryId = originalJob.CategoryId; model.JobTypeId = originalJob.HireTypeId; model.IsRemote = originalJob.IsRemote; model.LocationName = originalJob.Location.Name; model.LocationPlaceId = originalJob.Location.PlaceId; model.LocationLatitude = originalJob.Location.Latitude; model.LocationLongitude = originalJob.Location.Longitude; } else { return(RedirectToAction("Index", "Home").WithError("No tienes permiso para editar esta posición")); } } return(View(model)); }