public APIReturn _Add([FromForm] int?Parent_id, [FromForm] string Name) { MtypeInfo item = new MtypeInfo(); item.Parent_id = Parent_id; item.Name = Name; item = Mtype.Insert(item); return(APIReturn.成功.SetData("item", item.ToBson())); }
public ActionResult Edit([FromQuery] int Id) { MtypeInfo item = Mtype.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } ViewBag.item = item; return(View()); }
public APIReturn _Edit([FromQuery] int Id, [FromForm] int?Parent_id, [FromForm] string Name) { MtypeInfo item = Mtype.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } item.Parent_id = Parent_id; item.Name = Name; int affrows = Mtype.Update(item); if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }