예제 #1
0
        public ActionResult Create(FormCollection form)
        {
            using (var context = new ModelContainer())
            {
                var content = new Content();
                TryUpdateModel(content,
                               new[]
                                   {
                                       "Name",
                                       "Title",
                                       "PageTitle",
                                       "SortOrder",
                                       "MainPage",
                                       "SeoTitle",
                                       "SeoDescription",
                                       "SeoKeywords"
                                   });

                content.Text = HttpUtility.HtmlDecode(form["Text"]);
                content.SeoText = HttpUtility.HtmlDecode(form["SeoText"]);
                context.AddToContent(content);
                context.SaveChanges();
                return RedirectToAction("Index", "Home", new { Area = "", id = content.Name });
            }
        }