/// <summary>
        /// 读一个案例
        /// </summary>
        /// <param name="sr"></param>
        /// <returns></returns>
        public TestItems ReadOnes(StreamReader sr)
        {
            TestItems t = new TestItems();

            t.cases = ReadCases(sr);
            IList <TestItem> answer = new List <TestItem>();

            for (int i = 0; i < 5; i++)
            {
                TestItem ti = ReadOne(sr);
                answer.Add(ti);
            }
            t.testItems = answer;
            return(t);
        }
        /// <summary>
        /// 读案例
        /// </summary>
        public ActionResult DBAndlysis()
        {
            IList <TestItems> chioce = new List <TestItems>();
            FileStream        fs     = new FileStream(@"D:\Analysis.txt", FileMode.Open, FileAccess.Read);
            StreamReader      sr     = new StreamReader(fs, Encoding.Default);

            //读取文本内容存List
            while (sr.Peek() != -1)
            {
                TestItems t = ReadOnes(sr);
                chioce.Add(t);
            }
            //保存数据
            foreach (TestItems item in chioce)
            {
                andlysis.Cases  = item.cases;
                andlysis.Topics = new List <MultipleChoice>();
                foreach (TestItem items in item.testItems)
                {
                    MultipleChoice chioice = new MultipleChoice();
                    chioice.Topic   = items.Title;
                    chioice.Answer  = items.result;
                    chioice.OptionA = items.answer[0];
                    chioice.OptionB = items.answer[1];
                    chioice.OptionC = items.answer[2];
                    chioice.OptionD = items.answer[3];
                    chioice.UserId  = 1;
                    andlysis.Topics.Add(chioice);
                }

                db.CaseAnalysiss.Add(andlysis);
                db.SaveChanges();
            }

            sr.Close();
            return(RedirectToAction("Index", "Home"));
        }