// Index Nueva Inscripción (By Current Alumno User) public async Task <ActionResult> NuevaConsulta() { try { var departamentosTask = _departamentoEndpoint.GetAll(_userSession.BearerToken); var materiasTask = _materiaEndpoint.GetAll(_userSession.BearerToken); var profesoresTask = _usuarioEndpoint.GetAllProfesores(_userSession.BearerToken); await Task.WhenAll(departamentosTask, materiasTask, profesoresTask); var departamentos = _mapper.Map <IEnumerable <MvcDepartamentoModel> >(source: departamentosTask.Result); var materias = _mapper.Map <IEnumerable <MvcMateriaModel> >(source: materiasTask.Result); var profesores = _mapper.Map <IEnumerable <MvcUsuarioModel> >(source: profesoresTask.Result); var viewModel = new ShowHorariosParaInscribirViewModel( departamentos: departamentos, materias: materias, profesores: profesores); return(View(viewModel)); } catch (UnauthorizedRequestException) { return(RedirectToAction("AccessDenied", "Error")); } catch (Exception ex) { return(RedirectToAction("SpecificError", "Error", new { error = ex.Message })); } }
public async Task <ActionResult> Index() { try { IEnumerable <HorarioConsulta> entities = await _horarioConsultaEndpoint.GetAll(_userSession.BearerToken); var horariosConsulta = _mapper.Map <IEnumerable <MvcHorarioConsultaModel> >(entities); IEnumerable <Departamento> departamentosEntities = await _departamentoEndpoint.GetAll(_userSession.BearerToken); var departamentos = _mapper.Map <IEnumerable <MvcDepartamentoModel> >(source: departamentosEntities); var viewModel = new ShowHorariosConsultaViewModel( horariosConsulta: horariosConsulta, departamentos: departamentos); return(View(viewModel)); } catch (UnauthorizedRequestException) { return(RedirectToAction("AccessDenied", "Error")); } catch (Exception ex) { return(RedirectToAction("SpecificError", "Error", new { error = ex.Message })); } }
public async Task <ActionResult> Create() { try { IEnumerable <Departamento> entities = await _departamentoEndpoint.GetAll(_userSession.BearerToken); var departamentos = _mapper.Map <IEnumerable <MvcDepartamentoModel> >(entities); var viewModel = new CreateMateriaViewModel(departamentos); return(PartialView("_Create", viewModel)); } catch (UnauthorizedRequestException) { return(RedirectToAction("AccessDeniedPartial", "Error")); } catch (Exception ex) { return(RedirectToAction("SpecificErrorPartial", "Error", new { error = ex.Message })); } }
public async Task LoadDepartamentos() { try { IEnumerable <Departamento> entities = await _departamentoEndpoint.GetAll(_usuarioLogged.Token); Departamentos = _mapper.Map <BindingList <WpfDepartamentoModel> >(entities); } catch (UnauthorizedRequestException) { _events.PublishOnUIThread(new NotAuthorizedEvent()); } catch (Exception ex) { ErrorMessages = new BindingList <string> { $"{ex.Message} Ha ocurrido un error. Por favor contacte a soporte" }; } }