public ActionResult Remove(long id) { if (CategoryMng.Remove(id)) { return(ResultSuccess("操作成功")); } else { return(ResultError("操作失败")); } }
public ActionResult Edit(Category category) { using (var db = new MbContext()) { var model = db.Category.FirstOrDefault(t => t.Name == category.Name && t.CategoryId != category.CategoryId); if (model != null) { return(ResultError("不得与现存的类目名称相同")); } } if (CategoryMng.Update(category)) { return(ResultSuccess("操作成功", "/Category/Index")); } else { return(ResultError("操作失败", "/Category/Index")); } }
/// <summary> /// 修改 /// </summary> /// <returns></returns> public ActionResult Edit(long id = 0) { return(View(CategoryMng.Select(id))); }
/// <summary> /// 增加 /// </summary> /// <returns></returns> public ActionResult Add(long pid = 0) { return(View(CategoryMng.Select(pid))); }