Esempio n. 1
0
        public async Task <ActionResult> getScore(string pessoaId)
        {
            JsonResult           result   = new JsonResult();
            List <ScoreResponse> response = new List <ScoreResponse>();

            try
            {
                MyHttp myHttp = new MyHttp(@"https://hackathonbtpapi.azurewebsites.net/api/");
                response = await myHttp.Get <ScoreResponse>(string.Concat("Score/ObterPorPessoaId/", pessoaId));

                return(Json(new { data = response[0].Pontuacao }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { data = (int)HttpStatusCode.InternalServerError }));
            }
        }
Esempio n. 2
0
        public async Task <ActionResult> getAgendamentos(bool navio, bool atividade)
        {
            AgendamentoResponse response = new AgendamentoResponse();

            try
            {
                MyHttp myHttp = new MyHttp(@"https://hackathonbtpapi.azurewebsites.net/api/");
                var    result = await myHttp.Get(string.Concat("Agendamento/ObterPorModalidadeId/", navio.ToString().ToLower(), "&", atividade.ToString().ToLower()));

                MyFile.saveJson(result);
                response.jsonCalendar = result;
                response.ResultCode   = (int)HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                response.ResultCode = (int)HttpStatusCode.InternalServerError;
            }

            return(Json(new { data = response.jsonCalendar }, JsonRequestBehavior.AllowGet));
        }