public async Task <SurveyEditDTO[]> GetSurveys() { _cachedSurvey = null; string url = $"{_baseUrl}getall"; return(await _client.GetJsonAsync <SurveyEditDTO[]>(url)); }
public async Task <SurveyEditDTO> GetSurvey(Guid surveyId) { string url = $"{_baseUrl}get/{surveyId}"; _cachedSurvey = await _client.GetJsonAsync <SurveyEditDTO>(url); return(_cachedSurvey); }
protected override void OnParametersSet() { if (Id != null) { _surveyId = Guid.Parse(Id); survey = SurveyClient.CachedSurvey; } }
protected override void OnParametersSet() { if (Id != null) { _sectionId = Guid.Parse(Id); survey = SurveyClient.CachedSurvey; section = survey.Sections.FirstOrDefault(n => n.SectionId == _sectionId); } }
protected override void OnParametersSet() { Console.WriteLine("OnParametersSet #1"); if (SectionId != null) { _sectionId = Guid.Parse(SectionId); survey = SurveyClient.CachedSurvey; section = survey.Sections.FirstOrDefault(n => n.SectionId == _sectionId); } }
async Task <CommandSubmitResult <SurveyEditDTO> > PostCmd <T>(T cmd, string url) { var result = await _client.PostJsonAsync <CommandSubmitResult <SurveyEditDTO> >(url, cmd); if (result.Result == CommandSubmitExecutionResult.OK) { _cachedSurvey = result.EntityQry; } return(result); }
public async Task MakeLive() { var cmd = new SurveyDefinitionMakeLiveCmd(survey.SurveyId); var result = await SurveyClient.MakeLive(cmd); if (result.Result == CommandSubmitExecutionResult.OK) { survey = result.EntityQry; CanEdit = false; StateHasChanged(); } }
public async Task MoveItemDown(Guid surveyItemId) { var cmd = new SurveyDefinitionMoveSurveyItemDownCmd(survey.SurveyId, surveyItemId); var result = await SurveyClient.MoveItemDown(cmd); string m = result.Messages.FirstOrDefault(); Console.WriteLine($"Move down.... : {result.Result} - {m} "); if (result.Result == CommandSubmitExecutionResult.OK) { survey = result.EntityQry; StateHasChanged(); } }
public async Task DeleteQuestion(SurveyQuestionEditDTO question) { var cmd = new SurveyDefinitionRemoveSurveyItemCmd(survey.SurveyId, question.QuestionId); var result = await SurveyClient.DeleteSurveyItem(cmd); string m = result.Messages.FirstOrDefault(); Console.WriteLine($"Delete Question : {result.Result} - {m} "); if (result.Result == CommandSubmitExecutionResult.OK) { survey = result.EntityQry; StateHasChanged(); } }
protected override async Task OnParametersSetAsync() { Console.WriteLine("Edit Survey Page : OnParametersSetAsync #1 "); if (Id != "") { Console.WriteLine("Get from server, no cache"); _id = Guid.Parse(Id); survey = await SurveyClient.GetSurvey(_id); } else { Console.WriteLine("Use cache"); survey = SurveyClient.CachedSurvey; } CanEdit = (survey.Status == SurveyDefinitionStatusEnum.Edit); }