Example #1
0
 public ActionResult CreateArticle(string menuTitle = "")
 {
     if (!string.IsNullOrEmpty(menuTitle))
     {
         FindItemReponse <MenuModel> findParentMenu = _menuCategoryService.FindByTitle(menuTitle);
         if (findParentMenu.Item == null)
         {
             ViewBag.ErrorMessage = string.Format(Resources.AdminResource.msg_menuCategoryNotFound, menuTitle);
         }
     }
     return(View());
 }
        public ActionResult CreateCategoryMenu(MenuModel menu, string parentTitle)
        {
            if (ModelState.IsValid)
            {
                FindItemReponse <MenuModel> findParentMenu = _menuCategoryService.FindByTitle(parentTitle);
                if (findParentMenu.Item != null)
                {
                    menu.ParentID = findParentMenu.Item.MenuID;
                }
                menu.MenuID      = Guid.NewGuid().ToString();
                menu.ActionURL   = string.Format("{0}-{1}", UrlSlugger.ToUrlSlug(menu.Title), UrlSlugger.Get8Digits());
                menu.CreatedDate = DateTime.Now;

                InsertResponse response = _menuCategoryService.CreateMenu(menu);
            }
            return(RedirectToAction("Index"));
        }