public void EditContractor(object obj)
 {
     using (var context = new LedgerContext())
     {
         var contractorInDb = context.LedgerDictionaries.OfType<Contractor>().AsNoTracking().Single(x => x.Id == Contractor.Id);
         if (!Contractor.Equals(contractorInDb))
             context.Entry(Contractor).State = EntityState.Modified;
         context.SaveChanges();
     }
     CloseWindow();
 }
 public void EditEntry(object obj)
 {
     CheckIfAddedNewDictionaryEntry();
     using (var context = new LedgerContext())
     {
         var contractorInDb = context.LedgerDictionaries.OfType<Contractor>().AsNoTracking().Single(x => x.Id == Entry.Contractor.Id);
         if (!Entry.Contractor.Equals(contractorInDb))
             context.Entry(Contractor).State=EntityState.Modified;
         context.Entry(Entry).State=EntityState.Modified;
         context.SaveChanges();
     }
     Close();
 }