Example #1
0
 private static void UpdateFarmInIndex(Farm farm, IndexWriter indexWriter, ApplicationDbContext db)
 {
     var doc = CreateDocumentFromFarm(farm);
     indexWriter.UpdateDocument(new Term("id", farm.FarmId.ToString()), doc);
     db.Entry(farm).State = EntityState.Modified;
     farm.IndexDateTime = DateTime.Now;
 }
Example #2
0
 private void AddFarmToIndex(Farm farm, IndexWriter indexWriter, ApplicationDbContext db)
 {
     var doc = CreateDocumentFromFarm(farm);
     indexWriter.AddDocument(doc);
     db.Entry(farm).State = EntityState.Modified;
     farm.IndexDateTime = DateTime.Now;
 }