Пример #1
0
        public void DeleteQuestion(Question q)
        {
            List <Question> ListOfQuestions = GetAllQuestions();

            ListOfQuestions.Remove(q);
            JsonFileWritter.WriteToJson(ListOfQuestions, JsonFileName);
        }
Пример #2
0
        public void AddQuestion(Question q)
        {
            bool            QuestionExists  = false;
            List <Question> ListOfQuestions = GetAllQuestions();

            for (int i = 0; i < ListOfQuestions.Count; i++)
            {
                if (ListOfQuestions[i].Title.ToLower() == q?.Title.ToLower())
                {
                    QuestionExists     = true;
                    ListOfQuestions[i] = q;
                }
            }
            if (!QuestionExists)
            {
                ListOfQuestions.Add(q);
            }
            JsonFileWritter.WriteToJson(ListOfQuestions, JsonFileName);
        }