public ActionResult New()
        {
            ContentCategoryViewModel viewModel = new ContentCategoryViewModel
            {
                ContentCategory = new ContentCategory()
            };

            return(View(viewModel));
        }
        public ActionResult Edit(int id)
        {
            var dbEntryCat = _repo.GetContentCategory(id);

            if (dbEntryCat == null)
            {
                return(HttpNotFound());
            }

            if (dbEntryCat.Id == 1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Forbidden action"));
            }

            var viewModel = new ContentCategoryViewModel
            {
                ContentCategory = dbEntryCat
            };

            return(View(viewModel));
        }
        private IList <ContentCategoryViewModel> GetMenu(IList <ContentCategory> menuList, long?parentId)
        {
            var children = GetChildrenMenu(menuList, parentId);

            if (!children.Any())
            {
                return(new List <ContentCategoryViewModel>());
            }

            var vmList = new List <ContentCategoryViewModel>();

            foreach (var item in children)
            {
                var menu = GetMenuItem(menuList, item.Id);
                var vm   = new ContentCategoryViewModel();
                vm.Id       = menu.Id;
                vm.Title    = menu.Title;
                vm.Slug     = menu.Slug;
                vm.Children = GetMenu(menuList, menu.Id);
                vmList.Add(vm);
            }

            return(vmList);
        }