public async Task <IActionResult> CreatePost(AssesmentProfilesCreateViewModel model) { //if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) //{ // return Unauthorized(); //} var presentationprofile = _assesmentEngineManager.GetEngines().FirstOrDefault(x => x.Name == model.SourceName)?.Create(); presentationprofile.Id = Guid.NewGuid().ToString("N"); var editor = await _displayManager.UpdateEditorAsync(presentationprofile, updater : this, isNew : true); if (ModelState.IsValid) { await _assesmentEngineManager.SaveProfileAsync(presentationprofile.Name, presentationprofile); _notifier.Success(H["Profile created successfully"]); return(RedirectToAction("Index")); } // If we got this far, something failed, redisplay form model.Editor = editor; return(View(model)); }
public async Task <IActionResult> Create(string id) { //if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageQueries)) //{ // return Unauthorized(); //} var profile = _assesmentEngineManager.GetEngines().FirstOrDefault(x => x.Name == id)?.Create(); if (profile == null) { return(NotFound()); } var model = new AssesmentProfilesCreateViewModel { Editor = await _displayManager.BuildEditorAsync(profile, updater : this, isNew : true), SourceName = id }; return(View(model)); }