Beispiel #1
0
        public static DesignDocument EditDesignDoc(DesignDocument DDtoBeEdited)
        {
            Console.WriteLine("How do you want to edit the DesignDoc \n 1. Add Questions \n 2. Delete Question \n 3. Add answers to questions \n 4. Display Questionaire");
            int UserIn = Int32.Parse(Console.ReadLine());
            switch (UserIn)
            {
                case 1:
                    Console.WriteLine("Type a new question into Console");
                    String userInputString = Console.ReadLine();
                    Question newQue = new Question();
                    newQue.QuestionDescription = userInputString;
                    DDtoBeEdited.AddQuestions(newQue);
                    Console.WriteLine("Question added");
                    return DDtoBeEdited;

                case 2:
                    Console.WriteLine("Type the question number you want deleted into Console");
                    int userInputInt = Int32.Parse(Console.ReadLine());
                    DDtoBeEdited.RemoveQuestion(userInputInt);
                    Console.WriteLine(" Doc deleted");
                    return DDtoBeEdited;

                case 3:
                    Console.WriteLine("Add answers to questions");
                    foreach(Question q in DDtoBeEdited.getQuestions())
                    {
                        Console.WriteLine(q.QuestionDescription);
                        q.QuestionDescription = Console.ReadLine();
                    }

                    return DDtoBeEdited;

                case 4:
                     Console.WriteLine(DDtoBeEdited.ToString());
                    return DDtoBeEdited;
                default:
                    return DDtoBeEdited;
            }
        }
        private static void CreateDesignDocument()
        {
            Console.WriteLine("Creating the Design Document Questions... \n \n");
            DesignDocument designDocument = new DesignDocument();
            Console.WriteLine("What would you like to call your design document? \n \n");
            designDocument.DesignDocTitle = Console.ReadLine();

            foreach (Question q in designDocument.Questions)
            {
                Console.WriteLine(q.QuestionToAsk);
                string answer = Console.ReadLine();
                designDocument.AddUserNameToQuestion(q.QuestionIndex, answer);
            }

            Console.WriteLine("Would you like to add another question(Y/N) ? ");
            ConsoleKeyInfo userinput = Console.ReadKey();
            designDocument.AddUserQuestion(userinput);

            SaveFacade SF = new SaveFacade();
            SF.SaveXml(designDocument);
            SF.SaveTxt(designDocument);
        }