示例#1
0
 public ActionResult Create(FormCollection form)
 {
     using (var context = new ShopContainer())
     {
         var content = new Content();
         TryUpdateModel(content,
                        new[]
                            {
                                "Name",
                                "Title",
                                "PageTitle",
                                "SortOrder",
                                "Published",
                                "MainPage",
                                "SeoText",
                                "SeoDescription",
                                "SeoKeywords"
                            });
         content.Text = HttpUtility.HtmlDecode(form["Text"]);
         context.AddToContent(content);
         context.SaveChanges();
         return RedirectToAction("Index");
     }
 }