Exemplo n.º 1
0
        public ActionResult RenderTermSelect(int taxonomyId, int selectedTermId = -1) {
            if (!Services.Authorizer.Authorize(Permissions.ManageTerms, T("Not allowed to manage terms")))
                return new HttpUnauthorizedResult();

            var model = new SelectTermViewModel {
                Terms = _taxonomyService.GetTerms(taxonomyId),
                SelectedTermId = selectedTermId
            };

            return PartialView(model);
        }
Exemplo n.º 2
0
        public ActionResult SelectTerm(int taxonomyId) {
            if (!Services.Authorizer.Authorize(Permissions.CreateTerm, T("Not allowed to create terms")))
                return new HttpUnauthorizedResult();

            var terms = _taxonomyService.GetTerms(taxonomyId);

            if (terms.Any()) {
                var model = new SelectTermViewModel {
                    Terms = terms,
                    SelectedTermId = -1
                };

                return View(model);
            }

            return RedirectToAction("Create", new { taxonomyId, parentTermId = -1 });
        }