public FlashCard GetFlashCard(int id)
        {
            var flashCard = new FlashCard();

            using (var repo = new FlashCardRepository())
            {
                flashCard = repo.GetOne(id);
                repo.Context.Entry(flashCard).Collection(x => x.Tags).Load();
                repo.Context.Entry(flashCard).Collection(x => x.TextAnserws).Load();
                repo.Context.Entry(flashCard).Collection(x => x.FileAnserws).Load();
                repo.Context.Entry(flashCard).Reference(x => x.FlashCardData).Load();
            }
            return(flashCard);
        }
Пример #2
0
        void StartFlashCardRecallCommand()
        {
            //zablokowac mozliwosc zmiany danych
            //2 przyciski na dole - powtorzone poprawnie lub negatywnie
            var           flashCard = new FlashCard();
            List <string> tags      = new List <string>();

            using (var repo = new TagRepository())
            {
                tags = repo.GetAll().Select(x => x.Tag1).Distinct().ToList();
            }
            using (var repo = new FlashCardRepository())
            {
                flashCard = repo.GetOne(selectedFlashCard.Id);
                repo.Context.Entry(flashCard).Collection(x => x.Tags).Load();
                repo.Context.Entry(flashCard).Collection(x => x.TextAnserws).Load();
                repo.Context.Entry(flashCard).Collection(x => x.FileAnserws).Load();
                var addFlashCardWindow = new FlashCardDetailsWindow(new FlashCardDetails(flashCard, tags));
                addFlashCardWindow.ShowDialog();
            }
        }