/// <summary> /// 更新一条数据 /// </summary> public bool Update(Sys_Ads model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Sys_Ads set "); strSql.Append(" title = @title , "); strSql.Append(" picString = @picString , "); strSql.Append(" adString = @adString , "); strSql.Append(" createTime = @createTime , "); strSql.Append(" startTime = @startTime , "); strSql.Append(" endTime = @endTime , "); strSql.Append(" status = @status , "); strSql.Append(" viewNums = @viewNums , "); strSql.Append(" operatorId = @operatorId "); strSql.Append(" where id=@id "); int row = DapperHelper.Execute(strSql.ToString(), model); if (row > 0) { return(true); } else { return(false); } }
/// <summary> /// 新增加一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public int Add(Sys_Ads model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Sys_Ads("); strSql.Append("title,picString,adString,createTime,startTime,endTime,status,viewNums,operatorId"); strSql.Append(") values ("); strSql.Append("@title,@picString,@adString,@createTime,@startTime,@endTime,@status,@viewNums,@operatorId"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); object obj = DapperHelper.ExecuteScalar(strSql.ToString(), model); if (obj != null) { return(Convert.ToInt32(obj)); } else { return(0); } }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(Sys_Ads model) { Sys_AdsBaseDAL dal = new Sys_AdsBaseDAL(); return(dal.Update(model)); }
/// <summary> /// 新增加一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static int Add(Sys_Ads model) { Sys_AdsBaseDAL dal = new Sys_AdsBaseDAL(); return(dal.Add(model)); }