예제 #1
0
        public ActionResult AddSubmenu(int parentId, FormCollection form)
        {
            using (var context = new ContentStorage())
            {
                var parentContent = context.Content.Where(c => c.Id == parentId).First();
                var content = new Content();
                TryUpdateModel(content, new[]
                                            {
                                                "Name",
                                                "ContentModel",
                                                "Title",
                                                "MenuTitle",
                                                "PageTitle",
                                                "SortOrder",
                                                "SeoDescription",
                                                "SeoKeywords",
                                                //"ContentType",
                                                "ContentLevel",
                                                "PlaceKind"
                                            });
                content.Text = HttpUtility.HtmlDecode(form["Text"]);
                content.WeatherScript = HttpUtility.HtmlDecode(form["WeatherScript"]);
                content.Parent = parentContent;
                context.AddToContent(content);
                context.SaveChanges();

                if (content.PlaceKind > 0)
                    return RedirectToAction("Index", "Place", new { id = content.Name, area = "" });

                return RedirectToAction("Index", "Home", new { id = content.Name, area = "" });
            }
        }
예제 #2
0
 public ActionResult AddRegion(FormCollection form, int placeKind)
 {
     using (var context = new ContentStorage())
     {
         var content = new Content { PlaceKind = placeKind, ContentLevel = 1 };
         TryUpdateModel(content,
                        new[]{
                                "Name", 
                                "Title", 
                                "MenuTitle", 
                                "PageTitle", 
                                "SortOrder", 
                                "SeoDescription",
                                "SeoKeywords"
                        });
         content.Text = HttpUtility.HtmlDecode(form["Text"]);
         context.AddToContent(content);
         context.SaveChanges();
         return RedirectToAction("Index", "Home", new { id = content.Name, area = "" });
     }
 }