/// <summary> /// 更新一条数据 /// </summary> public void Update(Wuyiju.Model.AdminScores model) { StringBuilder sql = new StringBuilder(); sql.Append("update AdminScores set "); sql.Append(" type = @type , "); sql.Append(" score = @score , "); sql.Append(" content = @content , "); sql.Append(" status = @status , "); sql.Append(" admin_id = @admin_id , "); sql.Append(" user_id = @user_id , "); sql.Append(" shop_id = @shop_id "); sql.Append(" where id=@id "); DynamicParameters param = new DynamicParameters(); if (model != null) { param.AddDynamicParams(model); } var rows = db.Execute(sql, param); if (rows < 1) { throw new ApplicationException("更新数据无效"); } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Wuyiju.Model.AdminScores obj) { if (obj == null) { throw new ApplicationException("参数不能为空"); } dao.Insert(obj); }
/// <summary> /// 删除一条数据 /// </summary> public void Remove(Wuyiju.Model.AdminScores obj) { if (obj == null) { throw new ApplicationException("参数不能为空"); } var old = dao.Get(obj.Id); if (old == null) { throw new ApplicationException("非法操作记录不存在"); } dao.Delete(obj.Id); }
/// <summary> /// 增加一条数据 /// </summary> public void Insert(Wuyiju.Model.AdminScores model) { StringBuilder sql = new StringBuilder(); sql.Append("insert into ec_admin_scores("); sql.Append("type,score,content,status,admin_id,user_id,shop_id"); sql.Append(") values ("); sql.Append("@type,@score,@content,@status,@admin_id,@user_id,@shop_id"); sql.Append(") "); DynamicParameters param = new DynamicParameters(); if (model != null) { param.AddDynamicParams(model); } var rows = db.Execute(sql, param); if (rows < 1) { throw new ApplicationException("插入数据无效"); } }