//Delete
 public static void Delete(WordLocation wordLocation)
 {
     if (wordLocation.ID != 0)
     {
         using (RatzhKatzviEntities1 db = new RatzhKatzviEntities1())
         {
             try
             {
                 WordLocation isExist = db.WordLocation.Single(x => x.ID == wordLocation.ID);
                 if (isExist != null)
                 {
                     try
                     {
                         db.WordLocation.Remove(isExist);
                         db.SaveChanges();
                     }
                     catch (Exception ex)
                     {
                         Console.WriteLine(ex);
                     }
                 }
             }
             catch (Exception ex) { Console.WriteLine(ex); }
         }
     }
 }
 //Update
 public static void Update(WordLocation wordLocation)
 {
     using (RatzhKatzviEntities1 db = new RatzhKatzviEntities1())
     {
         try
         {
             WordLocation oldWordLocation = db.WordLocation.Where(w => (w.SearchId == wordLocation.SearchId || w.SubjectId == wordLocation.SubjectId) && w.BookSenteceID == wordLocation.BookSenteceID).FirstOrDefault();
             if (oldWordLocation != null)
             {
                 db.Entry(wordLocation).State = EntityState.Modified;
                 db.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
     }
 }
 //Add List
 public static void AddList(List <WordLocation> wordLocations)
 {
     using (RatzhKatzviEntities1 db = new RatzhKatzviEntities1())
     {
         List <WordLocation> newWordLocations = new List <WordLocation>();
         foreach (var wordLocation in wordLocations)
         {
             WordLocation isExist = db.WordLocation.FirstOrDefault(w => (w.SearchId == wordLocation.SearchId || w.SubjectId == wordLocation.SubjectId) && w.BookSenteceID == wordLocation.BookSenteceID);
             if (isExist == null)
             {
                 newWordLocations.Add(wordLocation);
             }
         }
         try
         {
             db.WordLocation.AddRange(newWordLocations);
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
     }
 }