public Document CreateDocument(Document document) { using (var db = new SearchEngineEntities()) { db.Documents.Add(document); db.SaveChanges(); return document; } }
public bool UpdateDocument(Document document) { using (var db = new SearchEngineEntities()) { if (document == null) { throw new ArgumentNullException("item"); } Document documentBeingUpdated = db.Documents.Single(e => e.ID == document.ID); documentBeingUpdated.IndexTime = document.IndexTime; documentBeingUpdated.URL = document.URL; db.SaveChanges(); return true; } }