瀏覽代碼

survey user form (3)

ganahrhr 2 年之前
父節點
當前提交
1ce2ff2c62
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      Pages/ModalSurvey.razor

+ 7 - 2
Pages/ModalSurvey.razor

@@ -77,8 +77,13 @@
 
         Console.WriteLine($"AnswerID: {_survey.SurveyItems[_currentQuestionID].AnswerID}.");
 
-        _currentQuestionPosition++;
-        _currentQuestionID = _survey.SurveyItemsSorted.FirstOrDefault(i => i.Value.Position == _currentQuestionPosition).Key;
+        if (_currentQuestionPosition < _survey.SurveyItems.Count)
+        {
+            _currentQuestionPosition++;
+            _currentQuestionID = _survey.SurveyItemsSorted.FirstOrDefault(i => i.Value.Position == _currentQuestionPosition).Key;
+        }
+        else
+            Close();
     }
 
     string PositionToLetter(int position)