private void AddAssetControl_SaveEvent(object sender, Asset e)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                        new Action(() =>
            {
                if (User != null)
                {
                    e.Department = User.Department;
                }

                using (var db = new AMSDB())
                {
                    if (db.Assets.Add(e) == null)
                    {
                        MessageBox.Show("Error Saving Asset. Please Retry", "Database Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        db.SaveChanges();
                        MessageBox.Show("Asset Saved", "Save Success", MessageBoxButton.OK, MessageBoxImage.Information);
                        Assets.Add(e);
                    }
                }
            }));
        }
        private void AssetGrid_SaveEvent(object sender, EventArgs e)
        {
            using (var db = new AMSDB())
            {
                var dbassets = (from a in db.Assets
                                where a.Department == User.Department
                                select a).OrderBy(n => n.Name);

                foreach (Asset a in dbassets)
                {
                    foreach (Asset b in Assets)
                    {
                        if (a.ID == b.ID)
                        {
                            b.Update();
                            a.AttendedOn = b.AttendedOn;
                            break;
                        }
                    }
                }
                this.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                            new Action(() =>
                {
                    AssetGrid.AssetDataGrid.DataContext = null;
                    AssetGrid.AssetDataGrid.DataContext = Assets;

                    MessageBox.Show("Assets Updated", "Update Info", MessageBoxButton.OK, MessageBoxImage.Information);
                }));
                db.SaveChanges();
            }
        }