private void ContractMainBtnNewContract_Click(object sender, RoutedEventArgs e)
 {
     Contract = new LokaVerkefniCL.Contract();
     ContractNew.DataContext = Contract;
     ContractNewComboBoxApartment.DataContext = ApartmentViewSource;
     ContractNewComboBoxTenant.DataContext    = TenantViewSource;
     ContractNewTxtEstimatedPrice.DataContext = ApartmentViewSource;
     ContractMain.Visibility = Visibility.Collapsed;
     ContractNew.Visibility  = Visibility.Visible;
 }
        private void ContractMainBtnDeleteContract_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Ertu viss um að þú viljir eyða samningnum?", "Staðfesting", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.No)
            {
            }
            else if (result == MessageBoxResult.Yes)
            {
                LokaVerkefniCL.Contract temp = (LokaVerkefniCL.Contract)ContractMainComboBoxApartment.SelectedItem;
                DContext.context.Contracts.Remove(temp);
                DContext.context.SaveChanges();
            }
        }
 private void ContractMainBtnEditContract_Click(object sender, RoutedEventArgs e)
 {
     Contract = new LokaVerkefniCL.Contract((LokaVerkefniCL.Contract)ContractMainComboBoxApartment.SelectedItem);
     ContractMain.Visibility = Visibility.Collapsed;
     ContractEdit.Visibility = Visibility.Visible;
 }