Ejemplo n.º 1
0
        public List <Account> GetAccountsForUser([FromUri] Guid?userId = null)
        {
            var accountDao = new AccountDao();

            if (userId.HasValue)
            {
                return(accountDao.GetAccountsForUser(userId.Value));
            }
            else
            {
                return(accountDao.GetAllAccounts());
            }
        }
Ejemplo n.º 2
0
        private void UpdateList()
        {
            //实例化一个accountDao
            //Dao数据库访问操作
            AccountDao accountDao = new AccountDao();
            //通过accountDao对象取出所有的用户
            List <Account> list = accountDao.GetAllAccounts();

            if (list != null)
            {
                StringBuilder sb = new StringBuilder();
                //遍历列表
                foreach (Account account in list)
                {
                    //生成html
                    sb.AppendFormat("<tr class='odd gradeX'><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td><div class='text-center'><button type = 'button' userId='{0}' class='btn btn-danger btn_delete' data-toggle='modal' data-target='#confirm-delete'>删除</button></td></tr>", account.Id, account.Username, account.Question, account.Answer, account.Mail, account.RegistTime);
                }
                UsersList = sb.ToString();
            }
        }