Ejemplo n.º 1
0
        public void AddWord(Word word)
        {
            var db = new LangInformantDbContext();

            db.Words.Add(word);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public void AddLesson(Lesson lesson)
        {
            var db = new LangInformantDbContext();

            db.Lessons.Add(lesson);
            db.SaveChanges();
        }
        public void AddMeaning(Meaning meaning)
        {
            var db = new LangInformantDbContext();

            db.Meanings.Add(meaning);
            db.SaveChanges();
        }
Ejemplo n.º 4
0
        public Lesson DeleteLesson(int lessonID)
        {
            var    db      = new LangInformantDbContext();
            Lesson dbEntry = db.Lessons.Find(lessonID);

            if (dbEntry != null)
            {
                db.Lessons.Remove(dbEntry);
                db.SaveChanges();
            }
            return(dbEntry);
        }
Ejemplo n.º 5
0
        public Word DeleteWord(int wordID)
        {
            var  db      = new LangInformantDbContext();
            Word dbEntry = db.Words.Find(wordID);

            if (dbEntry != null)
            {
                db.Words.Remove(dbEntry);
                db.SaveChanges();
            }
            return(dbEntry);
        }
        public Meaning DeleteMeaning(int meaningID)
        {
            var     db      = new LangInformantDbContext();
            Meaning dbEntry = db.Meanings.Find(meaningID);

            if (dbEntry != null)
            {
                db.Meanings.Remove(dbEntry);
                db.SaveChanges();
            }
            return(dbEntry);
        }
        public void SaveMeaning(Meaning meaning)
        {
            var db = new LangInformantDbContext();

            if (meaning.MeaningID == 0)
            {
                db.Meanings.Add(meaning);
                db.SaveChanges();
            }
            else
            {
                Meaning dbEntry = db.Meanings.Find(meaning.MeaningID);
                if (dbEntry != null)
                {
                    dbEntry.Name        = meaning.Name;
                    dbEntry.Description = meaning.Description;
                    dbEntry.Picture     = meaning.Picture;
                    dbEntry.Words       = meaning.Words;
                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 8
0
        public void SaveLesson(Lesson lesson)
        {
            var db = new LangInformantDbContext();

            if (lesson.LessonID == 0)
            {
                db.Lessons.Add(lesson);
                db.SaveChanges();
            }
            else
            {
                Lesson dbEntry = db.Lessons.Find(lesson.LessonID);
                if (dbEntry != null)
                {
                    dbEntry.Name         = lesson.Name;
                    dbEntry.Description  = lesson.Description;
                    dbEntry.Unit         = lesson.Unit;
                    dbEntry.Vocabularies = lesson.Vocabularies;
                    dbEntry.Scenes       = lesson.Scenes;

                    db.SaveChanges();
                }
            }
        }
Ejemplo n.º 9
0
        public void SaveWord(Word word)
        {
            var db = new LangInformantDbContext();

            if (word.WordID == 0)
            {
                db.Words.Add(word);
                db.SaveChanges();
            }
            else
            {
                Word dbEntry = db.Words.Find(word.WordID);
                if (dbEntry != null)
                {
                    dbEntry.Name        = word.Name;
                    dbEntry.Description = word.Description;
                    dbEntry.Sound       = word.Sound;
                    dbEntry.Meanings    = word.Meanings;
                    dbEntry.Language    = word.Language;
                    dbEntry.SoundVol    = word.SoundVol;
                    db.SaveChanges();
                }
            }
        }