Ejemplo n.º 1
0
        /// <summary>
        ///根据id修改一条数据(返)修改结果)
        /// </summary>
        public bool Update(Models.VisitLog Models)
        {
            string sqlStr = " update [MS_VisitLog] set ENTRY_URL=@ENTRY_URL,VISIT_IP=@VISIT_IP,VISIT_CITY=@VISIT_CITY,SESSION_GUID=@SESSION_GUID,STATE=@STATE where id = @id";

            using (var connection = new ConnectionCode().GetConnection())
            {
                return(connection.Execute(sqlStr, Models) > 0);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///添加一条数据(返)插入的数据的id)
        /// </summary>
        public int Add(Models.VisitLog Models)
        {
            string sqlStr = " insert into [MS_VisitLog](ENTRY_URL,VISIT_IP,VISIT_CITY,SESSION_GUID,STATE) values(@ENTRY_URL,@VISIT_IP,@VISIT_CITY,@SESSION_GUID,@STATE);select @@identity ";

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