public void Update() { Db_Tabl2 model = new Db_Tabl2() { id = 2005, Name = "rose1111" }; Assert.IsTrue(tBLL.Update(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Db_Tabl2 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE Tabl2 set "); strSql.Append(" AId = @AId , "); strSql.Append(" Name = @Name "); strSql.Append(" WHERE id=@id "); return(DapperHelper.Excute(strSql.ToString(), model) > 0); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Db_Tabl2 model) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO Tabl2("); strSql.Append("AId,Name"); strSql.Append(") OUTPUT INSERTED.ID VALUES ("); strSql.Append("@AId,@Name"); strSql.Append(") "); //var newClass = new //{ // AId = model.AId, // Name = model.Name //}; return((int)DapperHelper.ExecuteScalar(strSql.ToString(), model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Db_Tabl2 model) { return(dal.Update(model)); }
/// <summary> /// 添加一条数据 /// </summary> public int Add(Db_Tabl2 model) { return(dal.Add(model)); }