Пример #1
0
 public IEnumerable<Document> GetAllDocuments()
 {
     using (var db = new SearchEngineEntities())
     {
         return db.Documents.ToList();
     }
 }
Пример #2
0
 public IEnumerable<Term> GetAllTerms()
 {
     using (var db = new SearchEngineEntities())
     {
         return db.Terms.ToList();
     }
 }
Пример #3
0
 public IEnumerable<Contain> GetAllContains()
 {
     using (var db = new SearchEngineEntities())
     {
         return db.Contains.ToList();
     }
 }
Пример #4
0
 public void DeleteDocument(int id)
 {
     using (var db = new SearchEngineEntities())
     {
         Document document = db.Documents.Single(e => e.ID == id);
         db.Documents.Remove(document);
         db.SaveChanges();
     }
 }
Пример #5
0
 public Document CreateDocument(Document document)
 {
     using (var db = new SearchEngineEntities())
     {
         db.Documents.Add(document);
         db.SaveChanges();
         return document;
     }
 }
Пример #6
0
 public void DeleteTerm(int id)
 {
     using (var db = new SearchEngineEntities())
     {
         Term term = db.Terms.Single(e => e.ID == id);
         db.Terms.Remove(term);
         db.SaveChanges();
     }
 }
Пример #7
0
 public Term CreateTerm(Term term)
 {
     using (var db = new SearchEngineEntities())
     {
         db.Terms.Add(term);
         db.SaveChanges();
         return term;
     }
 }
Пример #8
0
        //public bool Updatecontain(Contain contain)
        //{
        //    using (var db = new SearchEngineEntities())
        //    {
        //        if (contain == null)
        //        {
        //            throw new ArgumentNullException("item");
        //        }
        //        Contain containBeingUpdated = db.Contains.Single(e => e.ID == document.ID);
        //        containBeingUpdated = contain;
        //        containBeingUpdated= contain;
        //        db.SaveChanges();
        //        return true;
        //    }
        //}

        public void DeleteContain(int id)
        {
            using (var db = new SearchEngineEntities())
            {
                Contain contain = db.Contains.Single(e => e.termId == id);
                db.Contains.Remove(contain);
                db.SaveChanges();
            }
        }
Пример #9
0
 public Contain CreateContain(Contain contain)
 {
     using (var db = new SearchEngineEntities())
     {
         db.Contains.Add(contain);
         db.SaveChanges();
         return contain;
     }
 }
Пример #10
0
 public Document GetDocument(int id)
 {
     using (var db = new SearchEngineEntities())
     {
         var Document = from e in db.Documents
                        where e.ID == id
                        select e;
         return Document.FirstOrDefault();
     }
 }
Пример #11
0
 public Term GetTerm(int id)
 {
     using (var db = new SearchEngineEntities())
     {
         var Term = from e in db.Terms
                    where e.ID == id
                    select e;
         return Term.FirstOrDefault();
     }
 }
Пример #12
0
 public Contain GetContain(int id)
 {
     using (var db = new SearchEngineEntities())
     {
         var Contain = from e in db.Contains
                       where e.termId == id
                       select e;
         return Contain.FirstOrDefault();
     }
 }
Пример #13
0
 public bool UpdateTerm(Term term)
 {
     using (var db = new SearchEngineEntities())
     {
         if (term == null)
         {
             throw new ArgumentNullException("item");
         }
         Term termBeingUpdated = db.Terms.Single(e => e.ID == term.ID);
         termBeingUpdated.value = term.value;
         db.SaveChanges();
         return true;
     }
 }
Пример #14
0
 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;
     }
 }