Ejemplo n.º 1
0
        public ActionResult UpdateCatalog(CatalogView catalog)
        {
            try
            {
                var article = Article.Find(catalog.Id);
                if (article != null)
                {
                    article.Name = catalog.Name;
                    article.Order = catalog.Order;
                    article.ParentId = catalog.ParentId;
                    article.Save();
                    return this.Json(new ActionResultStatus(), JsonRequestBehavior.AllowGet);
                }

                return this.Json(new ActionResultStatus(10, "目录不存在!"), JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return this.Json(new ActionResultStatus(ex), JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 2
0
 public ActionResult CreateCatalog(CatalogView catalog)
 {
     try
     {
         var article = new Article() { Category = Category.Catalog, Name = catalog.Name, Order = catalog.Order, ParentId = catalog.ParentId };
         article.Create();
         return this.Json(new ActionResultStatus(), JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return this.Json(new ActionResultStatus(ex), JsonRequestBehavior.AllowGet);
     }
 }