public override void Execute(FlashcardsClient client, string userName) { var collections = UiHelpingMethods.GetCollections(client); if (collections.Count != 0) { Console.WriteLine("From which collection do you want create a test?"); Console.WriteLine("Enter the number of collection"); var collectionNumber = int.Parse(Console.ReadLine()); var cardsCount = client.GetCollectionCards(collectionNumber).Count; if (cardsCount != 0) { Console.WriteLine( "Here you can choose how much questions of each type you need. You also can choose 0 if you don't want one of types"); var request = new List <TestBlock>(); AddQuestionRequest(request, "Enter the number of choice question", "choice"); AddQuestionRequest(request, "Enter the number of matching question", "matching"); AddQuestionRequest(request, "Enter the number of open answer question", "open"); client.GenerateTest(collectionNumber, request); Console.WriteLine("Test created! You can pass it and see results by command -check"); } else { Console.WriteLine("Whoops! You don't have any cards in this collection. How about adding new one by command -ac"); } } else { Console.WriteLine("Whoops! You don't have any collections. How about creating new one by command -cc"); } }
public override void Execute(FlashcardsClient client, string userName) { var testAnswers = GetTestAnswers(client); if (testAnswers == null) { return; } var testVerdict = client.GetCheckedTest(testAnswers); if (testVerdict.WrongAnswers == 0) { Console.WriteLine($"Correct answers: {testVerdict.CorrectAnswers}/{testVerdict.Answers.Count}"); Console.WriteLine("Well done! You solved test correctly!"); } else { Console.WriteLine($"Correct answers: {testVerdict.CorrectAnswers}/{testVerdict.Answers.Count}"); Console.WriteLine($"Wrong answers: {testVerdict.WrongAnswers}/{testVerdict.Answers.Count}"); Console.WriteLine("Correct answers for your mistakes"); foreach (var(id, verdict) in testVerdict.Answers) { if (!verdict.Correct) { ExerciseHandler.ShowCorrectAnswers( client.LastReceivedTest.Exercises.First(e => e.Id == id).Question, verdict.CorrectAnswer); } } } }
public override void Execute(FlashcardsClient client, string userName) { Console.WriteLine("Input name for new collection"); var collectionName = Console.ReadLine(); client.CreateCollection(collectionName); Console.WriteLine("Collection created!"); }
public override void Execute(FlashcardsClient client, string userName) { UiHelpingMethods.GetCollections(client); Console.WriteLine("Enter the number of collection"); var number = int.Parse(Console.ReadLine()); client.DeleteCollection(number); Console.WriteLine("Collection deleted!"); }
public override void Execute(FlashcardsClient client, string userName) { var collections = UiHelpingMethods.GetCollections(client); Console.WriteLine("Enter the number of collection"); var number = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the term"); var term = Console.ReadLine(); Console.WriteLine("Enter the definition"); var definition = Console.ReadLine(); var card = new Card(term, definition, userName, collections[number].Id); client.AddCardToCollection(card); Console.WriteLine($"Card created and added to collection '{collections[number].Name}'"); }
private static TestAnswers GetTestAnswers(FlashcardsClient client) { if (client.LastReceivedTest == null) { Console.WriteLine("You had not request for a test. Do it by command -test"); return(null); } var testAnswers = new List <ExerciseAnswer>(); foreach (var exercise in client.LastReceivedTest.Exercises) { testAnswers.Add(ExerciseHandler.HandleQuestion(exercise)); } return(new TestAnswers { TestId = client.LastReceivedTest.TestId, Answers = testAnswers }); }
public abstract void Execute(FlashcardsClient client, string userName);
public override void Execute(FlashcardsClient client, string userName) { UiHelpingMethods.GetCollections(client); }
public override void Execute(FlashcardsClient client, string userName) { client.GetAllCards(); UiHelpingMethods.GetCards(client); }