Beispiel #1
0
        /// <summary>
        ///根据id修改一条数据(返)修改结果)
        /// </summary>
        public bool Update(Models.TouchMsg Models)
        {
            string sqlStr = " update [MS_TouchMsg] set USER_EMAIL=@USER_EMAIL,MSG=@MSG,STATE=@STATE,LAST_CHANGE_TIME=@LAST_CHANGE_TIME,LAST_CHANGE_IP=@LAST_CHANGE_IP where id = @id";

            using (var connection = new ConnectionCode().GetConnection())
            {
                return(connection.Execute(sqlStr, Models) > 0);
            }
        }
Beispiel #2
0
        /// <summary>
        ///添加一条数据(返)插入的数据的id)
        /// </summary>
        public int Add(Models.TouchMsg Models)
        {
            string sqlStr = " insert into [MS_TouchMsg](USER_EMAIL,MSG,STATE,LAST_CHANGE_TIME,LAST_CHANGE_IP) values(@USER_EMAIL,@MSG,@STATE,@LAST_CHANGE_TIME,@LAST_CHANGE_IP);select @@identity ";

            using (var connection = new ConnectionCode().GetConnection())
            {
                return(connection.Query <int>(sqlStr, Models).SingleOrDefault());
            }
        }