public JsonResult PostResult([FromBody] PostSurveyResultModel model)
        {
            SurveyResultLog surveyLog = new SurveyResultLog();
            int             clientid  = Convert.ToInt32(HttpContext.Session.GetString("Clientid"));
            var             db        = new Dao(HttpContext.Session);

            db.PostResults(model.postId, model.surveyResult, clientid);
            return(Json("Ok"));
        }
Пример #2
0
        public void PostResults(string postId, string resultJson, int clientid)
        {
            var             storage = GetResults();
            SurveyResultLog survey  = new SurveyResultLog();

            survey.postId           = postId;
            survey.surveyanswerJson = resultJson;
            survey.clientId         = clientid;
            _context.SurveyResulLog.Add(survey);
            _context.SaveChanges();
            if (!storage.ContainsKey(postId))
            {
                storage[postId] = new List <string>();
            }
            storage[postId].Add(resultJson);
            session.SetString("ResultsStorage", JsonConvert.SerializeObject(storage));
        }