Ejemplo n.º 1
0
        public ActionResult Add(FormCollection form)
        {
            using (var context = new StructureContainer())
            {
                var content = new Content { MainPage = false, IsGallery = false };

                TryUpdateModel(content, new[]
                                            {
                                                "Name",
                                                "Title",
                                                "TitleEng",
                                                "PageTitle",
                                                "PageTitleEng",
                                                "SortOrder",
                                                "SeoDescription",
                                                "SeoKeywords"
                                            });
                content.Text = HttpUtility.HtmlDecode(form["Text"]);
                content.TextEng = HttpUtility.HtmlDecode(form["TextEng"]);

                context.AddToContent(content);

                context.SaveChanges();

                return RedirectToAction("Index", "Home", new { id = content.Name, area = "" });
            }
        }