Ejemplo n.º 1
0
        public IActionResult GetResourceDepartures([FromHeader] string Token)
        {
            try
            {
                UserDataHandler authUser = new AuthService(_context).GetUserByToken(Token);

                if (authUser != null)
                {
                    var resourceDepartures = new ResourcesService(_context).GetResourceDepartures();

                    if (!resourceDepartures.Any())
                    {
                        return(BadRequest("Não há saídas de recursos."));
                    }
                    return(Ok(resourceDepartures));
                }
                else
                {
                    return(Unauthorized("Token inválido."));
                }
            }
            catch (System.Exception)
            {
                throw;
            }
        }