Example #1
0
        public List <CommentLogic> CommentId(int id)
        {
            CommentDb connection = new CommentDb();

            DataTable dataTable = connection.CommentId(id);

            List <CommentLogic> list = new List <CommentLogic>();

            foreach (DataRow dr in dataTable.Rows)
            {
                CommentLogic comment = new CommentLogic();
                comment.id     = Convert.ToInt32(dr["Id"]);
                comment.sender = dr["Sender"].ToString();
                comment.text   = dr["Text"].ToString();
                comment.date   = Convert.ToDateTime(dr["Date"]);

                list.Add(comment);
            }
            return(list);
        }