private static void AddSearchPieceInDB(string piece) { using (DbModelContext dbContext = new DbModelContext()) { IstoricCautari tempHistory = new IstoricCautari { Id_Cautare = StringToGUID(piece), Valoare = piece.Trim(), Cod = piece.Trim().GetHashCode().ToString() }; dbContext.IstoricCautari.Add(tempHistory); dbContext.SaveChanges(); } }
private static void InsertCompleteIdiomInDatabase(string stringToSearch, string searchIdiomCode) { using (DbModelContext dbContext = new DbModelContext()) { try { IstoricCautari history = new IstoricCautari() { Cod = searchIdiomCode, Valoare = stringToSearch, Id_Cautare = StringToGUID(stringToSearch) }; dbContext.IstoricCautari.Add(history); dbContext.SaveChanges(); } catch { } } }