예제 #1
0
 public ActionResult Remove(long id)
 {
     if (CategoryMng.Remove(id))
     {
         return(ResultSuccess("操作成功"));
     }
     else
     {
         return(ResultError("操作失败"));
     }
 }
예제 #2
0
        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"));
            }
        }
예제 #3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <returns></returns>
 public ActionResult Edit(long id = 0)
 {
     return(View(CategoryMng.Select(id)));
 }
예제 #4
0
 /// <summary>
 /// 增加
 /// </summary>
 /// <returns></returns>
 public ActionResult Add(long pid = 0)
 {
     return(View(CategoryMng.Select(pid)));
 }