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(); }
public async Task <ActionResult> Delete(long id) { await _questionsRepository.Delete(id); return(Json(new { isSuccess = true })); }