public virtual ActionResult SaveAnswer(string surveyId, string answer, string email, string searchResult, string storeId) { if (_sessionContext.CurrentUser == null && string.IsNullOrEmpty(email)) { return(JsonSuccess(false, JsonRequestBehavior.AllowGet)); } var userId = Guid.Empty; if (_sessionContext.CurrentUser != null) { userId = _sessionContext.CurrentUser.UserId; email = _sessionContext.CurrentUser.Username; } var answerModel = new SurveyAnswerModel { SurveyId = new Guid(surveyId), UserId = userId, UserName = email, Answers = answer, SearchResult = searchResult, CreatedBy = email }; var result = _surveyApi.SaveAnswers(answerModel); return(JsonSuccess(true, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveAnswerBulk(Guid surveyId, List <SurveyProfileAnswerModel> answers) { SurveyProfileModel model = new SurveyProfileModel() { SelectedAnswers = answers, SurveyId = surveyId //ProductId = productId }; if (_sessionContext.CurrentUser != null && _sessionContext.CurrentUser.UserId != null) { model.UserId = _sessionContext.CurrentUser.UserId; } if (model.UserId == null || model.UserId == Guid.Empty) { model.VisitorId = Guid.NewGuid(); } var apiResult = _surveyApi.SaveAnswers(model); var responseModel = GetLinkedProducts(surveyId, answers); return(JsonSuccess(responseModel, JsonRequestBehavior.AllowGet)); }