コード例 #1
0
        public void ResetSurveyAnswers(string phone, int surveyId)
        {
            User user       = _userRepository.GetByPhone(phone);
            var  userSurvey = _surveyRepository.GetUserSurvey(user.Id, surveyId);

            userSurvey.PageCompleted = 0;
            userSurvey.CompletedOn   = null;

            var savedAnswers = _questionAnswerRepository.GetSurveyAnswers(user.Id, surveyId);

            if (savedAnswers.Any())
            {
                foreach (var ans in savedAnswers)
                {
                    _questionAnswerRepository.Delete(ans);
                }
            }

            _unitOfWork.Commit();
        }
コード例 #2
0
        public async Task <ActionResult> Delete(long id)
        {
            await _questionsRepository.Delete(id);

            return(Json(new { isSuccess = true }));
        }