public ActionResult UpdateColumn(ColumnView column) { try { var article = Article.Find(column.Id); if (article != null) { article.Name = column.Name; article.Order = column.Order; 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); } }
public ActionResult CreateColumn(ColumnView column) { try { var article = new Article() { Category = Category.Columns, Name = column.Name, Order = column.Order }; article.Create(); return this.Json(new ActionResultStatus(), JsonRequestBehavior.AllowGet); } catch (Exception ex) { return this.Json(new ActionResultStatus(ex), JsonRequestBehavior.AllowGet); } }