Esempio n. 1
0
        public ActionResult MoveTerm(int taxonomyId, string termIds)
        {
            if (!Services.Authorizer.Authorize(Permissions.CreateTerm, T("Not allowed to move terms")))
            {
                return(new HttpUnauthorizedResult());
            }

            var terms = ResolveTermIds(termIds);

            if (!terms.Any())
            {
                return(HttpNotFound());
            }

            var model = new MoveTermViewModel {
                Terms = (from t in _taxonomyService.GetTerms(taxonomyId)
                         from st in terms
                         where !(t.FullPath + "/").StartsWith(st.FullPath + "/")
                         select t).Distinct().ToList(),
                TermIds        = terms.Select(x => x.Id),
                SelectedTermId = -1
            };

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

            var term = _taxonomyService.GetTerm(termId);

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

            var model = new MoveTermViewModel {
                Terms          = _taxonomyService.GetTerms(taxonomyId).Where(t => !(t.FullPath + "/").StartsWith(term.FullPath + "/")),
                TermId         = termId,
                SelectedTermId = -1
            };

            return(View(model));
        }