private static void VoteAddManager(UnverifiedQuestion questionData) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(questionData); verifiedQuestionResult.Match( verifiedQuestion => { var id = Guid.NewGuid(); IReadOnlyCollection <VoteEnum> votes = Array.Empty <VoteEnum>(); var question = new AskQuestionResult.QuestionAdded(id, questionData.Title, questionData.Text, questionData.Tags, 0, votes); question = new VoteManager().Update(question, VoteEnum.Up); question = new VoteManager().Update(question, VoteEnum.Up); question = new VoteManager().Update(question, VoteEnum.Down); Console.WriteLine(question.Votes.Count); return(Unit.Default); }, ex => { Console.WriteLine("Question data could not be verified"); return(Unit.Default); } ); }
private static void EnableVoteQuestion(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(question); verifiedQuestionResult.Match( EnableVoteQuestion => { new VerifyVotesService().Vote(EnableVoteQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("This question can't be voted"); return(Unit.Default); } ); }
private static void VoteQuestion(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(question); verifiedQuestionResult.Match( VoteQuestion => { new VoteService().Vote(VoteQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("You can't vote the question!"); return(Unit.Default); } ); }
private static void ReviewQuestionText(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(question); verifiedQuestionResult.Match( verifiedQuestion => { new ReviewQuestionService().RewriteQuestionText(verifiedQuestion).Wait(); return(Unit.Default); }, ex => { Console.WriteLine("Question could not be verified"); return(Unit.Default); } ); }
private static void StartQuestion(UnverifiedQuestion question) { var verifiedQuestionResult = new VerifyQuestionService().VerifyQuestion(question); verifiedQuestionResult.Match( verifiedQuestion => { new VoteService().SendVote(verifiedQuestion); return(Unit.Default); }, ex => { Console.WriteLine("Impossible to vote"); return(Unit.Default); } ); }
private static void VoteQuestion(UnverifiedBody body) { var verifiedQuestionResult = new VerifyQuestionService().VerifyBody(body); verifiedQuestionResult.Match( voteQuestion => { new VoteQuestionService().SendPermissionToVote(voteQuestion); return(Unit.Default); }, ex => { Console.WriteLine("Question could not be verified, votting is not allowed."); return(Unit.Default); } ); }