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