public async Task <IActionResult> VisualizarUnidade(int idDaUnidade) { var unidadeViewModel = _mapper.Map <Unidade, UnidadeViewModel>(await _unidadeAppService.ConsultarPeloIdAsync(idDaUnidade)); var professorViewModel = _mapper.Map <Professor, ProfessorViewModel>(await _professorAppService.ConsultarPelaUnidadeAsync(Convert.ToInt32(unidadeViewModel.IdDoProfessor))); var vincularProfessorViewModel = new VincularProfessorViewModel(unidadeViewModel, professorViewModel); return(View(vincularProfessorViewModel)); }
public async Task <IActionResult> VincularProfessor(int idDaUnidade) { var unidadeViewModel = _mapper.Map <Unidade, UnidadeViewModel>(await _unidadeAppService.ConsultarPeloIdAsync(idDaUnidade)); TempData["IdDaUnidade"] = unidadeViewModel.IdDaUnidade; TempData["NomeDaUnidade"] = unidadeViewModel.NomeDaUnidade; TempData["DiretorioDaUnidade"] = unidadeViewModel.DiretorioDaUnidade; TempData["IdDoModulo"] = unidadeViewModel.IdDoModulo; var professoresViewModel = _mapper.Map <IEnumerable <Professor>, IEnumerable <ProfessorViewModel> >(await _professorAppService.ConsultarTodosProfessoresAsync()); var vincularProfessorViewModel = new VincularProfessorViewModel(unidadeViewModel, professoresViewModel); return(View(vincularProfessorViewModel)); }