public Word FindByID(object EntityID) { using (db = new LearnWordsEntities()) { return(db.Words.Find(EntityID)); } }
public Profile FindByID(object EntityID) { using (db = new LearnWordsEntities()) { return(db.Profiles.Find(EntityID)); } }
public void Insert(Word Entity) { using (db = new LearnWordsEntities()) { db.Words.Add(Entity); db.SaveChanges(); } }
public void Insert(Profile Entity) { using (db = new LearnWordsEntities()) { db.Profiles.Add(Entity); db.SaveChanges(); } }
public void Delete(Word Entity) { using (db = new LearnWordsEntities()) { Word word = db.Words.FirstOrDefault(w => w.wordID == Entity.wordID); db.Words.Remove(word); db.SaveChanges(); } }
public void Delete(WordType Entity) { using (db = new LearnWordsEntities()) { WordType wordType = db.WordTypes.FirstOrDefault(wt => wt.typeID == Entity.typeID); db.WordTypes.Remove(wordType); db.SaveChanges(); } }
public void Delete(Profile Entity) { using (db = new LearnWordsEntities()) { Profile profile = db.Profiles.FirstOrDefault(p => p.ProfileID == Entity.ProfileID); db.Profiles.Remove(profile); db.SaveChanges(); } }
public void Update(WordType Entity) { using (db = new LearnWordsEntities()) { WordType wordType = db.WordTypes.FirstOrDefault(wt => wt.typeID == Entity.typeID); wordType.typeName = Entity.typeName; wordType.profileID = Entity.profileID; db.SaveChanges(); } }
public Word FindByLambda(Expression <Func <Word, bool> > Filter = null) { if (Filter != null) { using (db = new LearnWordsEntities()) { return(db.Words.FirstOrDefault(Filter)); } } return(null); }
public void Update(Word Entity) { using (db = new LearnWordsEntities()) { Word wordToUpdate = db.Words.FirstOrDefault(w => w.wordID == Entity.wordID); wordToUpdate.wordFirstLang = Entity.wordFirstLang; wordToUpdate.wordSecondLang = Entity.wordSecondLang; wordToUpdate.typeID = Entity.typeID; wordToUpdate.profileID = Entity.profileID; db.SaveChanges(); } }
public void Update(Profile Entity) { using (db = new LearnWordsEntities()) { Profile profileToUpdate = db.Profiles.FirstOrDefault(p => p.ProfileID == Entity.ProfileID); profileToUpdate.ProfileName = Entity.ProfileName; profileToUpdate.ProfileUserName = Entity.ProfileUserName; profileToUpdate.ProfileUserLastName = Entity.ProfileUserLastName; profileToUpdate.ProfileTimeInterval = Entity.ProfileTimeInterval; profileToUpdate.ProfileFirstLang = Entity.ProfileFirstLang; profileToUpdate.ProfileSecondLang = Entity.ProfileSecondLang; db.SaveChanges(); } }
public List <Word> Select(Expression <Func <Word, bool> > Filter = null) { if (Filter != null) { using (db = new LearnWordsEntities()) { return(db.Words.Where(Filter).ToList()); } } else { using (db = new LearnWordsEntities()) { return(db.Words.ToList()); } } }