Пример #1
0
        public void AddLesson(Lesson lesson)
        {
            var db = new LangInformantDbContext();

            db.Lessons.Add(lesson);
            db.SaveChanges();
        }
Пример #2
0
        public Lesson GetLesson(int lessonID)
        {
            var    db      = new LangInformantDbContext();
            Lesson dbEntry = db.Lessons.Find(lessonID);

            return(dbEntry);
        }
Пример #3
0
        public Word GetWord(int wordID)
        {
            var  db      = new LangInformantDbContext();
            Word dbEntry = db.Words.Find(wordID);

            return(dbEntry);
        }
        public Meaning GetMeaning(int meaningID)
        {
            var     db      = new LangInformantDbContext();
            Meaning dbEntry = db.Meanings.Find(meaningID);

            return(dbEntry);
        }
Пример #5
0
        public void AddWord(Word word)
        {
            var db = new LangInformantDbContext();

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

            db.Meanings.Add(meaning);
            db.SaveChanges();
        }
Пример #7
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);
        }
Пример #8
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();
                }
            }
        }
Пример #11
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();
                }
            }
        }
Пример #12
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();
                }
            }
        }
Пример #13
0
        public IQueryable <Lesson> GetLessons()
        {
            var db = new LangInformantDbContext();

            return(from l in db.Lessons select l);
        }
Пример #14
0
        public IQueryable <Word> GetWords()
        {
            var db = new LangInformantDbContext();

            return(from w in db.Words select w);
        }
        public IQueryable <Meaning> GetMeanings()
        {
            var db = new LangInformantDbContext();

            return(from m in db.Meanings select m);
        }