/// <summary> ///根据id修改一条数据(返)修改结果) /// </summary> public bool Update(Models.NAV Models) { string sqlStr = " update [MS_NAV] set TITLE=@TITLE,URL=@URL,POWER=@POWER,CLASS=@CLASS,TYPE=@TYPE,STATE=@STATE,BACKUP1=@BACKUP1 where id = @id"; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Execute(sqlStr, Models) > 0); } }
/// <summary> ///添加一条数据(返)插入的数据的id) /// </summary> public int Add(Models.NAV Models) { string sqlStr = " insert into [MS_NAV](TITLE,URL,POWER,CLASS,TYPE,STATE,BACKUP1) values(@TITLE,@URL,@POWER,@CLASS,@TYPE,@STATE,@BACKUP1);select @@identity "; using (var connection = new ConnectionCode().GetConnection()) { return(connection.Query <int>(sqlStr, Models).SingleOrDefault()); } }