Esempio n. 1
0
        public ActionResult Index(int?id)
        {
            ViewBag.IsRootSections = id != null;

            var sections = id == null
                         ? _sectionService.GetRootSections()
                         : _sectionService.Find(id.Value);

            return(View(sections));
        }
Esempio n. 2
0
        public ActionResult Edit(int id)
        {
            var model = _sectionService.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
        public ActionResult Create(int id)
        {
            var section = _sectionService.Find(id);

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

            var topic = new ExampleTopic
            {
                Status    = TopicStatus.Draft,
                SectionId = section.Id,
                Section   = section
            };

            return(View(topic));
        }
        public virtual ActionResult Edit(long sectionId)
        {
            var section = sectionService.Find(sectionId);

            if (section == null || !permissionService.IsAllowed((Int32)SectionOperations.View, this.CorePrincipal(), typeof(Section), section.Id, IsSectionOwner(section), PermissionOperationLevel.Object))
            {
                throw new HttpException((int)HttpStatusCode.NotFound, HttpContext.Translate("Messages.NotFound", ResourceHelper.GetControllerScope(this)));
            }

            bool allowManage = permissionService.IsAllowed((Int32)SectionOperations.Manage, this.CorePrincipal(),
                                                           typeof(Section), section.Id, IsSectionOwner(section),
                                                           PermissionOperationLevel.Object);

            return(View("Edit", new SectionViewModel {
                AllowManage = allowManage
            }.MapFrom(section)));
        }