public ActionResult <List <Account> > GetAccounts() { List <Account> accounts = AccountDAO.GetAccounts(User.Identity.Name); if (accounts == null) { return(NotFound()); } return(Ok(accounts)); }
public ActionResult <List <Account> > GetAccounts() { List <Account> accounts = AccountDAO.GetAccounts(); if (accounts == null) { return(NotFound()); } return(accounts); }
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()); }
// [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); }
public Account GetAccount(int id) { Account accounts = _accountDAO.GetAccounts(id); return(accounts); }
public Accounts GetAccounts(int id) { Accounts accounts = _accountsdao.GetAccounts(id); return(accounts); }