/// <summary>
        /// 故事卡片返回到树
        /// </summary>
        /// <param name="StorySeriesID"></param>
        public IActionResult ReturnTree(string StorySeriesID)
        {
            CreatorSchedule creatorSchedule = _context.CreatorSchedule.AsNoTracking().FirstOrDefault(a => a.UserID == GetUserId() && a.StorySeriesID == Guid.Parse(StorySeriesID));

            if (creatorSchedule != null)
            {
                return(RedirectToAction(nameof(FlowChart), new { id = StorySeriesID }));
            }
            else
            {
                return(NotFound());
            }
        }
        /// <summary>
        /// 根据故事卡片Id返回
        /// </summary>
        /// <param name="id">故事卡片</param>
        /// <returns></returns>
        public IActionResult Index(string id)
        {
            try
            {
                var Creatorschedule = _context.CreatorSchedule.FirstOrDefault(a => a.UserID == GetUserId() && a.StorySeriesID == Guid.Parse(id));
                if (Creatorschedule != null)
                {
                    Guid lastStoryCardID = Creatorschedule.StoryCardID;
                    ViewBag.LastCard = _context.StoryCard.AsNoTracking().Include(a => a.StoryOptions).FirstOrDefault(a => a.ID == lastStoryCardID);
                }
                else
                {
                    StoryCard card = new StoryCard()
                    {
                        ID            = Guid.NewGuid(),
                        StorySeriesID = Guid.Parse(id),
                        StoryName     = _context.StorySeries.AsNoTracking().Where(a => a.ID == Guid.Parse(id)).First().SeriesName,
                        Title         = string.Empty,
                        Text          = string.Empty,
                        IsHead        = true
                    };

                    CreatorSchedule creatorSchedule = new CreatorSchedule()
                    {
                        ID            = Guid.NewGuid(),
                        UserID        = GetUserId(),
                        StorySeriesID = Guid.Parse(id),
                        StoryCardID   = card.ID
                    };
                    _context.CreatorSchedule.Add(creatorSchedule);
                    _context.StoryCard.Add(card);

                    ViewBag.LastCard = card;
                }
                _context.SaveChanges();
                //List<StoryCard> storyCards = _context.StoryCard.AsNoTracking().Where(a => a.StorySeriesID == Guid.Parse(id)).Include(a => a.StoryOptions).ToList();
                //return View(storyCards);
                return(View());
            }
            catch
            {
                return(NotFound());
            }
        }
        /// <summary>
        /// 返回故事卡信息
        /// 将故事卡ID设为作家日程表的主卡,并交由Index显示
        /// </summary>
        /// <param name="ID">卡片ID</param>
        /// <param name="ID">卡片ID</param>
        /// <returns></returns>
        public IActionResult GetCard(string StoryCardID, string StorySeriesID)
        {
            CreatorSchedule schedule = _context.CreatorSchedule.FirstOrDefault(a => a.UserID == GetUserId() && a.StorySeriesID == Guid.Parse(StorySeriesID));

            if (schedule != null)
            {
                schedule.StoryCardID = Guid.Parse(StoryCardID);
                _context.SaveChanges();
                return(RedirectToAction(nameof(Index), new { id = StorySeriesID }));
            }
            else if (isReviewer())
            {
                return(RedirectToAction("ReviewIndex", new { seriesID = StorySeriesID, cardID = StoryCardID }));
            }
            else
            {
                return(NotFound());
            }
        }
        /// <summary>
        /// 移动到下一卡片,若id无则新建
        /// </summary>
        /// <returns>Id 选项ID</returns>
        public IActionResult NextCard(Guid Id)
        {
            Guid nextCardId;

            try
            {
                StoryOption storyOption = _context.StoryOption.FirstOrDefault(a => a.ID == Id);
                StoryCard   storyCard   = _context.StoryCard.FirstOrDefault(a => a.ID == storyOption.StoryCardID);
                if (string.IsNullOrEmpty(storyOption.NextStoryCardID.ToString()) || storyOption.NextStoryCardID == Guid.Empty)
                {
                    StoryCard NewStoryCard = new StoryCard()
                    {
                        ID            = Guid.NewGuid(),
                        StorySeriesID = storyCard.StorySeriesID,
                        StoryName     = _context.StorySeries.AsNoTracking().Where(a => a.ID == storyCard.StorySeriesID).First().SeriesName,
                        Title         = string.Empty,
                        Text          = string.Empty
                    };
                    _context.StoryCard.Add(NewStoryCard);
                    nextCardId = NewStoryCard.ID;
                    storyOption.NextStoryCardID = NewStoryCard.ID;
                }
                else if (isReviewer())
                {
                    return(RedirectToAction(nameof(ReviewIndex), new { seriesID = storyCard.StorySeriesID, cardID = storyOption.NextStoryCardID }));
                }
                else
                {
                    nextCardId = storyOption.NextStoryCardID;
                }
                CreatorSchedule schedule = _context.CreatorSchedule.FirstOrDefault(a => a.UserID == GetUserId() && a.StorySeriesID == storyCard.StorySeriesID);
                schedule.StoryCardID = nextCardId;
                _context.SaveChanges();

                return(RedirectToAction(nameof(Index), new { id = schedule.StorySeriesID }));
            }
            catch (Exception ex)
            {
                return(NotFound());
            }
        }