Beispiel #1
0
        public static void Create(string username, string detail, int questionID)
        {
            IDbConnection db      = new SqlConnection(server);
            Answers       answers = new Answers()
            {
                Username   = username,
                Detail     = detail,
                QuestionID = questionID,
                Posted     = DateTime.Now.ToString(),
                UpVotes    = 0
            };

            db.Insert(answers);
        }
Beispiel #2
0
        public static void Create(string username, string detail, int questionID)
        {
            IDbConnection db      = new SqlConnection(server);
            Answers       answers = new Answers()
            {
                Username   = username,
                Detail     = detail,
                QuestionID = questionID,
                Posted     = DateTime.Now.ToString(),
                UpVotes    = 0
            };

            db.Query($"Insert Into Answers (Username, Detail, QuestionID, Posted, UpVotes) Values ('{username}', '{detail}', '{questionID}', '{answers.Posted}', '0')");
            //db.Insert(answers);
        }
Beispiel #3
0
        public static void Update(Answers answers, string detail)
        {
            IDbConnection db = new SqlConnection(server);

            answers.Detail = detail;

            /*
             * Answers answers = new Answers()
             * {
             *  Detail = detail,
             *  ID = answerID,
             *  Posted = DateTime.Now.ToString()
             * };
             */
            db.Update(answers);
        }
Beispiel #4
0
        public static void Update(Answers answers, string detail)
        {
            IDbConnection db = new SqlConnection(server);

            answers.Detail = detail;

            /*
             * Answers answers = new Answers()
             * {
             *  Detail = detail,
             *  ID = answerID,
             *  Posted = DateTime.Now.ToString()
             * };
             */
            //db.Update(answers);
            db.Query($"Update Answers SET Detail='{answers.Detail}' where ID='{answers.ID}'");
        }