Ejemplo n.º 1
0
        void AddMeaning(Word selectedWord)
        {
            _meaningRepository.Add(new Meaning()
            {
                WordId      = selectedWord.ID,
                MeaningWord = txtMeaning.Text.Trim()
            });

            MessageBox.Show("Anlam Tanımlandı.");
        }
Ejemplo n.º 2
0
        private void BrnSetImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog file = new OpenFileDialog();

            file.Filter      = "Si Dosyası |*.si";
            file.FilterIndex = 1;
            file.ShowDialog();

            var json   = System.IO.File.ReadAllText(file.FileName);
            var set    = Newtonsoft.Json.JsonConvert.DeserializeObject <SetExportModel>(json);
            var newSet = new Set()
            {
                Name = set.Name + " " + DateTime.Now.ToString()
            };

            Repository.Add(newSet);

            foreach (var item in set.Words)
            {
                var newWord = new Word()
                {
                    SetId    = newSet.ID,
                    WordText = item.WordText
                };
                _wordRepository.Add(newWord);

                var meanings = set.Meanings.Where(x => x.WordId == item.ID).ToList();
                foreach (var mItem in meanings)
                {
                    var newMeaning = new Meaning()
                    {
                        MeaningWord = mItem.MeaningWord,
                        WordId      = newWord.ID
                    };
                    _meaningRepository.Add(newMeaning);
                }
            }
            MessageBox.Show("Set İçeri Aktarıldı.");
        }