@@ -63,6 +63,11 @@ public Dictionary<string, string> GetSurveys() {
63
63
return GetFromSession < Dictionary < string , string > > ( "SurveyStorage" , surveys ) ;
64
64
}
65
65
66
+ public Dictionary < string , List < string > > GetResults ( ) {
67
+ Dictionary < string , List < string > > results = new Dictionary < string , List < string > > ( ) ;
68
+ return GetFromSession < Dictionary < string , List < string > > > ( "ResultsStorage" , results ) ;
69
+ }
70
+
66
71
public string GetSurvey ( string surveyId ) {
67
72
return GetSurveys ( ) [ surveyId ] ;
68
73
}
@@ -78,5 +83,19 @@ public void DeleteSurvey(string surveyId) {
78
83
storage . Remove ( surveyId ) ;
79
84
session . SetString ( "SurveyStorage" , JsonConvert . SerializeObject ( storage ) ) ;
80
85
}
86
+
87
+ public void PostResults ( string postId , string resultJson ) {
88
+ var storage = GetResults ( ) ;
89
+ if ( ! storage . ContainsKey ( postId ) ) {
90
+ storage [ postId ] = new List < string > ( ) ;
91
+ }
92
+ storage [ postId ] . Add ( resultJson ) ;
93
+ session . SetString ( "ResultsStorage" , JsonConvert . SerializeObject ( storage ) ) ;
94
+ }
95
+
96
+ public List < string > GetResults ( string postId ) {
97
+ var storage = GetResults ( ) ;
98
+ return storage . ContainsKey ( postId ) ? storage [ postId ] : new List < string > ( ) ;
99
+ }
81
100
}
82
101
}
0 commit comments