예제 #1
0
        public async Task <IActionResult> EditPost(PresentationProfilesEditViewModel model)
        {
            //if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries))
            //{
            //    return Unauthorized();
            //}

            var presentationprofile = await _presentatinProfileManager.GetPresentationProfileAsync(model.Name);

            if (presentationprofile == null)
            {
                return(NotFound());
            }

            var editor = await _displayManager.UpdateEditorAsync(presentationprofile, updater : this, isNew : false);

            if (ModelState.IsValid)
            {
                await _presentatinProfileManager.SavePresentationProfileAsync(model.Name, presentationprofile);

                _notifier.Success(H["Profile updated successfully"]);
                return(RedirectToAction("Profiles"));
            }

            model.Editor = editor;

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
예제 #2
0
        public async Task <IActionResult> Edit(string id)
        {
            //if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries))
            //{
            //    return Unauthorized();
            //}

            var presentationprofile = await _presentatinProfileManager.GetPresentationProfileAsync(id);

            if (presentationprofile == null)
            {
                return(NotFound());
            }

            var model = new PresentationProfilesEditViewModel
            {
                SourceName = presentationprofile.Source,
                Name       = presentationprofile.Name,
                Editor     = await _displayManager.BuildEditorAsync(presentationprofile, updater : this, isNew : false)
            };

            return(View(model));
        }