Ejemplo n.º 1
0
        public ActionResult <List <Account> > GetAccountsForCurrentUser()
        {
            //we need to get the UserID of currently logged in user
            int            id     = Convert.ToInt32(User.FindFirst("sub")?.Value);
            List <Account> result = accountDAO.GetAccountsByUserId(id);

            if (result.Count == 0)
            {
                return(BadRequest("No accounts were found for the user currently logged in"));
            }
            else
            {
                return(Ok(result));
            }
        }