示例#1
0
        public async Task <bool> SaveTabularDataAnswer(Guid applicationId, Guid sectionId, string pageId, string questionId, TabularData tabularData)
        {
            var tabularDataDeduplicated = _tabularDataService.DeduplicateData(tabularData);

            var answerJson = JsonConvert.SerializeObject(tabularDataDeduplicated);
            var answers    = new List <Answer>
            {
                new Answer
                {
                    QuestionId = questionId,
                    Value      = answerJson
                }
            };

            if (tabularData.DataRows.Count == 0)
            {
                var resultReset = await _apiClient.ResetPageAnswers(applicationId, sectionId, pageId);

                return(await Task.FromResult(resultReset.ValidationPassed));
            }

            var result = await _apiClient.UpdatePageAnswers(applicationId, sectionId, pageId, answers);

            return(await Task.FromResult(result.ValidationPassed));
        }