Exemplo n.º 1
0
        public async Task <IActionResult> GetCategory()
        {
            try
            {
                string authorizationHeader = _context.HttpContext.Request.Headers["Authorization"];

                if (authorizationHeader != null)
                {
                    var token = authorizationHeader.Split(" ");
                    authorizationHeader = token.Last();
                }

                var accountNumber = _funcIdentity.GetAuthorizationHeader(authorizationHeader);
                if (accountNumber != null)
                {
                    return(Ok(await _categoryServices.GetCategoriesRecursive()));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }