public Product_buyruleInfo Save() { if (this.Id != null) { Product_buyrule.Update(this); return(this); } return(Product_buyrule.Insert(this)); }
public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Product_id, [FromForm] uint?Discount, [FromForm] uint?Ordering_end, [FromForm] uint?Ordering_start) { Product_buyruleInfo item = Product_buyrule.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } item.Product_id = Product_id; item.Discount = Discount; item.Ordering_end = Ordering_end; item.Ordering_start = Ordering_start; int affrows = Product_buyrule.Update(item); if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }