Ejemplo n.º 1
0
        public ActionResult <List <Account> > GetAccounts()
        {
            List <Account> accounts = AccountDAO.GetAccounts(User.Identity.Name);

            if (accounts == null)
            {
                return(NotFound());
            }
            return(Ok(accounts));
        }
Ejemplo n.º 2
0
        public ActionResult <List <Account> > GetAccounts()
        {
            List <Account> accounts = AccountDAO.GetAccounts();

            if (accounts == null)
            {
                return(NotFound());
            }
            return(accounts);
        }
Ejemplo n.º 3
0
        public ActionResult <int> GetAccounts()
        {
            int            userId   = int.Parse(User.FindFirst("sub").Value);
            List <Account> accounts = accountDAO.GetAccounts(userId);

            if (accounts != null)
            {
                return(Ok(accounts));
            }

            return(NotFound());
        }
Ejemplo n.º 4
0
        //  [Authorize(Roles = "User, Admin")]
        public ActionResult <List <Account> > GetAccountsByUsername(string username)
        {
            //todo if it they don't have access, return an empty list IF WE WANT
            if (username.ToLower() != User.Identity.Name && !User.IsInRole("Admin")) // <- this is magic
            {
                return(NotFound());
            }
            List <Account> accounts = AccountDAO.GetAccounts(username);

            if (accounts == null)
            {
                return(NotFound());
            }
            return(accounts);
        }
Ejemplo n.º 5
0
        public Account GetAccount(int id)
        {
            Account accounts = _accountDAO.GetAccounts(id);

            return(accounts);
        }
Ejemplo n.º 6
0
        public Accounts GetAccounts(int id)
        {
            Accounts accounts = _accountsdao.GetAccounts(id);

            return(accounts);
        }