private async Task <DialogTurnResult> SendResponseToUserAsync( WaterfallStepContext stepContext, CancellationToken cancellationToken) { UserProfile userProfile = await this.state.UserProfile.GetAsync( stepContext.Context, () => new UserProfile(), cancellationToken); userProfile.SurveyState.Progress = ProgressState.InProgress; MultipleChoiceQuestionResponse feedbackResponse = this.HandleUserResponse(stepContext); userProfile.SurveyState.Responses.Add(feedbackResponse); ApprenticeFeedback feedback = userProfile.ToApprenticeFeedback(); await this.feedbackService.SaveFeedbackAsync(feedback); await this.Responses.Create( stepContext.Context, userProfile.SurveyState, this.botSettings, this.features, cancellationToken); // Ask next question return(await stepContext.NextAsync(cancellationToken : cancellationToken)); }
private SaveFeedbackCommand BuildCommand(ApprenticeFeedback feedback) { SaveFeedbackCommand command = new SaveFeedbackCommand() { Feedback = feedback }; return(command); }
public Task SaveFeedbackAsync(ApprenticeFeedback feedback) { SaveFeedbackCommand command = new SaveFeedbackCommand() { Feedback = feedback }; return(this.saveFeedbackCommandHandler.HandleAsync(command)); }
private async Task <DialogTurnResult> SaveFeedbackAsync( WaterfallStepContext stepContext, CancellationToken cancellationToken) { UserProfile userProfile = await this.state.UserProfile.GetAsync( stepContext.Context, () => new UserProfile(), cancellationToken); ApprenticeFeedback feedback = userProfile.ToApprenticeFeedback(); await this.feedbackService.SaveFeedbackAsync(feedback); return(await stepContext.NextAsync(cancellationToken : cancellationToken)); }
public SaveFeedbackTest() { this.feedback = new ApprenticeFeedback() { StartTime = DateTime.UtcNow.AddMinutes(-5), FinishTime = DateTime.UtcNow, SurveyId = SurveyId, Apprentice = FakeFeedbackRepository.CreateApprentice(UniqueLearnerNumber, UserId), Apprenticeship = FakeFeedbackRepository.CreateStandard(Ukprn, StandardId), Responses = new List <ApprenticeResponse>() { FakeFeedbackRepository.CreateResponse(100, "question1", "yeah", "yes"), FakeFeedbackRepository.CreateResponse(100, "question2", "nah", "no") } }; this.feedbackRepo.When(x => x.SaveFeedback(Arg.Any <ApprenticeFeedbackDto>())) .Do( async x => { string key = Guid.NewGuid().ToString(); var dto = x.Arg <ApprenticeFeedbackDto>(); var success = FakeFeedbackRepository.Feedback.TryAdd(key, dto); }); }
public Task UpdateFeedbackAsync(ApprenticeFeedback feedback) { throw new System.NotImplementedException(); }