Пример #1
0
        public async Task <SurveyEditDTO[]> GetSurveys()
        {
            _cachedSurvey = null;
            string url = $"{_baseUrl}getall";

            return(await _client.GetJsonAsync <SurveyEditDTO[]>(url));
        }
Пример #2
0
        public async Task <SurveyEditDTO> GetSurvey(Guid surveyId)
        {
            string url = $"{_baseUrl}get/{surveyId}";

            _cachedSurvey = await _client.GetJsonAsync <SurveyEditDTO>(url);

            return(_cachedSurvey);
        }
Пример #3
0
 protected override void OnParametersSet()
 {
     if (Id != null)
     {
         _surveyId = Guid.Parse(Id);
         survey    = SurveyClient.CachedSurvey;
     }
 }
Пример #4
0
 protected override void OnParametersSet()
 {
     if (Id != null)
     {
         _sectionId = Guid.Parse(Id);
         survey     = SurveyClient.CachedSurvey;
         section    = survey.Sections.FirstOrDefault(n => n.SectionId == _sectionId);
     }
 }
Пример #5
0
 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);
     }
 }
Пример #6
0
        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);
        }
Пример #7
0
        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();
            }
        }
Пример #8
0
        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();
            }
        }
Пример #9
0
        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();
            }
        }
Пример #10
0
 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);
 }