Beispiel #1
0
        public int QuestionEdit([FromBody] dynamic Json)
        {
            TestpaperitemModel testpaperitemModel = new TestpaperitemModel
            {
                question      = Json.question,
                paperid       = Json.paperid,
                select1_score = Json.select1_score,
                select2_score = Json.select2_score,
                select3_score = Json.select3_score,
                select4_score = Json.select4_score
            };

            return(testpaperitemRepository.Update(testpaperitemModel));
        }
Beispiel #2
0
        public int Update(TestpaperitemModel item)
        {
            string cmdText = "UPDATE `testpaperitem` SET `question` = ?question, `paperid`= ?paperid, `select1_score`= ?select1_score, `select2_score`= ?select2_score, `select3_score`= ?select3_score, `select4_score`= ?select4_score WHERE (`iid`=?iid);";

            MySqlParameter[] param = new MySqlParameter[] {
                new MySqlParameter("?question", MySqlDbType.String),
                new MySqlParameter("?paperid", MySqlDbType.Int32),
                new MySqlParameter("?select1_score", MySqlDbType.Float),
                new MySqlParameter("?select2_score", MySqlDbType.Float),
                new MySqlParameter("?select3_score", MySqlDbType.Float),
                new MySqlParameter("?select4_score", MySqlDbType.Float),
            };
            param[0].Value = item.question;
            param[1].Value = item.paperid;
            param[2].Value = item.select1_score;
            param[3].Value = item.select2_score;
            param[4].Value = item.select3_score;
            param[5].Value = item.select4_score;

            return(MysqlHelper.ExecuteNonQuery(cmdType, cmdText, param));
        }
Beispiel #3
0
        public int Insert(TestpaperitemModel item)
        {
            string cmdText = "INSERT INTO testpaperitem (`question`, `paperid`, `select1_score`, `select2_score`, `select3_score`, `select4_score`) VALUES (?question, ?paperid,?select1_score,?select2_score,?select3_score,?select4_score);";

            MySqlParameter[] param = new MySqlParameter[] {
                new MySqlParameter("?question", MySqlDbType.String),
                new MySqlParameter("?paperid", MySqlDbType.Int32),
                new MySqlParameter("?select1_score", MySqlDbType.Float),
                new MySqlParameter("?select2_score", MySqlDbType.Float),
                new MySqlParameter("?select3_score", MySqlDbType.Float),
                new MySqlParameter("?select4_score", MySqlDbType.Float),
            };
            param[0].Value = item.question;
            param[1].Value = item.paperid;
            param[2].Value = item.select1_score;
            param[3].Value = item.select2_score;
            param[4].Value = item.select3_score;
            param[5].Value = item.select4_score;

            return(MysqlHelper.ExecuteNonQuery(cmdType, cmdText, param));
        }