Exemple #1
0
        public JsonResult UpdateTaxonomy(FormValues formValues)
        {
            var id       = formValues.GetMetaValueAsLong("id") ?? 0;
            var parentId = formValues.GetMetaValueAsLong(AppKey.ParentId);

            var user              = _userManager.FindByNameAsync(User.Identity.Name).Result;
            var taxonomy          = _taxonomyHelper.UpdateTaxonomy(parentId, id, formValues.Details, user);
            var taxonomyViewModel = _taxonomyHelper.TaxonomyToViewModel(taxonomy);

            var result = new BaseAjaxResult(JsonResultState.Success, "The taxonomy was deleted.", taxonomyViewModel);

            return(Json(result));
        }
Exemple #2
0
        public JsonResult NewTaxonomy(FormValues formValues)
        {
            var taxonomyTypeId = formValues.Meta[AppKey.TaxonomyTypeId];
            var parentId       = formValues.GetMetaValueAsLong(AppKey.ParentId);

            var user              = _userManager.FindByNameAsync(User.Identity.Name).Result;
            var taxonomy          = _taxonomyHelper.CreateTaxonomy(Int64.Parse(taxonomyTypeId), parentId, null, formValues.Details, user);
            var taxonomyViewModel = _taxonomyHelper.TaxonomyToViewModel(taxonomy);

            return(Json(taxonomyViewModel));
        }