protected async Task OnSubmit() { var cmd = new SurveyResponseSetSubmittedCmd(SurveyResponse.SurveyResponseId); var response = await SurveyResponseClient.CompleteResponse(cmd); UriHelper.NavigateTo($"/surveyresponseoverview/{SurveyResponse.SurveyResponseId}"); }
protected async Task OnCancel() { var cmd = new SurveyResponseSetCancelledCmd(SurveyResponse.SurveyResponseId); var response = await SurveyResponseClient.CancelResponse(cmd); UriHelper.NavigateTo($"/surveyresponseoverview/{SurveyResponse.SurveyResponseId}"); }
async Task <bool> LoadForEditResponse(Guid responseId) { SurveyResponse = await SurveyResponseClient.GetResponse(responseId); CheckIsNotAlreadySubmitted(); Load(); return(true); }
async Task <bool> LoadQuestion(Guid responseId, Guid questionId) { SurveyResponse = await SurveyResponseClient.GetResponse(responseId); CheckIsNotAlreadySubmitted(); Load(); Response = SurveyResponse.ByQuestion(questionId); DoBindings(); return(true); }
async Task <bool> LoadForAddResponse(Guid surveyId) { var cmd = new SurveyResponseCreateCmd(surveyId); var response = await SurveyResponseClient.AddResponse(cmd); if (response.Result == CommandSubmitExecutionResult.OK) { SurveyResponse = response.EntityQry; Load(); } Console.WriteLine($" Result - {response.Result}"); return(true); }
protected override async Task OnParametersSetAsync() { if (Id != null) { _surveyId = Guid.Parse(Id); var survey = await SurveyClient.GetSurvey(_surveyId); SurveyName = survey.Name; SurveyIntro = survey.Intro; var responses = await SurveyResponseClient.GetSurveyResponses(_surveyId); Responses = responses.ToList(); } }
async Task <(bool, SurveyResponseDTO)> SaveRatingResponse() { //validation necessary - will always be in range of values? var cmd = new SurveyResponseRatingResponseCmd(SurveyResponse.SurveyResponseId, Response.Question.QuestionId, RatingAnswer); var response = await SurveyResponseClient.RatingResponse(cmd); if (response.Result == CommandSubmitExecutionResult.Fail) { ValidationMessage = response.Messages.FirstOrDefault(); return(false, null); } return(true, response.EntityQry); }
async Task <(bool, SurveyResponseDTO)> SaveTextResponse() { if (string.IsNullOrWhiteSpace(TxtAnswer)) { ValidationMessage = "Please answer text question"; return(false, null); } var cmd = new SurveyResponseTextResponseCmd(SurveyResponse.SurveyResponseId, Response.Question.QuestionId, TxtAnswer); var response = await SurveyResponseClient.TextResponse(cmd); if (response.Result == CommandSubmitExecutionResult.Fail) { ValidationMessage = response.Messages.FirstOrDefault(); return(false, null); } return(true, response.EntityQry); }
async Task <(bool, SurveyResponseDTO)> SaveMultiChoiceResponse() { if (!MultiOptionAnswers.Any(n => n.Selected)) { ValidationMessage = "Please select at least one response"; return(false, null); } var cmd = new SurveyResponseMultiOptionResponseCmd(SurveyResponse.SurveyResponseId, Response.Question.QuestionId, MultiOptionAnswers.Where(n => n.Selected).Select(n => n.ChoiceId).ToArray()); var response = await SurveyResponseClient.MultiOptionResponse(cmd); if (response.Result == CommandSubmitExecutionResult.Fail) { ValidationMessage = response.Messages.FirstOrDefault(); return(false, null); } return(true, response.EntityQry); }
async Task <(bool, SurveyResponseDTO)> SaveSingleChoiceResponse() { if (SingleOptionAnswer == Guid.Empty) { ValidationMessage = "Please select a response"; return(false, null); } var cmd = new SurveyResponseSingleOptionResponseCmd(SurveyResponse.SurveyResponseId, Response.Question.QuestionId, SingleOptionAnswer); var response = await SurveyResponseClient.SingleOptionResponse(cmd); if (response.Result == CommandSubmitExecutionResult.Fail) { ValidationMessage = response.Messages.FirstOrDefault(); return(false, null); } return(true, response.EntityQry); }
protected override async Task OnParametersSetAsync() { var responseId = Guid.Parse(SurveyResponseId); SurveyResponse = await SurveyResponseClient.GetResponse(responseId); }