Ejemplo n.º 1
0
 public RedirectToRouteResult AddTestPaper(TestpapersModel testpapers)
 {
     Debug.WriteLine(testpapers.papername + "!!!!!!!!!!!!");
     testpapersRepository.Insert(testpapers);
     return(RedirectToRoute(new
     {
         controller = "Admin",
         action = "PaperAdd",
     }));//重定向
 }
Ejemplo n.º 2
0
        public int Insert(TestpapersModel item)
        {
            string cmdText = "INSERT INTO testpapers (`papername`, `introduce`, `gradeproduct`, `select1_name`, `select2_name`, `select3_name`, `select4_name`) VALUES (?papername, ?introduce, ?gradeproduct, ?select1_name,?select2_name,?select3_name,?select4_name);";

            MySqlParameter[] param = new MySqlParameter[] {
                new MySqlParameter("?papername", MySqlDbType.String),
                new MySqlParameter("?introduce", MySqlDbType.String),
                new MySqlParameter("?gradeproduct", MySqlDbType.Float),
                new MySqlParameter("?select1_name", MySqlDbType.String),
                new MySqlParameter("?select2_name", MySqlDbType.String),
                new MySqlParameter("?select3_name", MySqlDbType.String),
                new MySqlParameter("?select4_name", MySqlDbType.String),
            };
            param[0].Value = item.papername;
            param[1].Value = item.introduce;
            param[2].Value = item.gradeproduct;
            param[3].Value = item.select1_name;
            param[4].Value = item.select2_name;
            param[5].Value = item.select3_name;
            param[6].Value = item.select4_name;
            return(MysqlHelper.ExecuteNonQuery(cmdType, cmdText, param));
        }