コード例 #1
0
        public IHttpActionResult Dashboard(DateTime requisicoesMensal, int diaRequisicoesDiarias, int tipo)
        {
            try
            {
                var httpRequest = HttpContext.Current.Request;

                if (Request.Headers.Authorization != null)
                {
                    var token = Request.Headers.Authorization.Parameter;

                    IRestResponse verificaSeEstaLogado = Requisicoes.AutenticaToFront(token, 3);

                    if (verificaSeEstaLogado.StatusCode == HttpStatusCode.OK)
                    {
                        return(Ok(_appLog.MontaDadosDashboard(requisicoesMensal, diaRequisicoesDiarias, tipo)));
                    }
                    else
                    {
                        return(Content(verificaSeEstaLogado.StatusCode, ""));
                    }
                }
                else
                {
                    return(Content(HttpStatusCode.Forbidden, ""));
                }
            }
            catch
            {
                return(BadRequest());
            }
        }