private void ExecuteAccept()
        {
            if (Delivered.Count > 0 && Delivered.First().ProductId != 0)
            {
                try
                {
                    Date = Date.Date;
                    Date = Date.AddHours(Time.Hour);
                    Date = Date.AddMinutes(Time.Minute);
                    if (Date > DateTime.Now)
                    {
                        Date = DateTime.Now;
                    }
                    CreatedSupply.Date = Date;
                    CreatedSupply.DeliveredToWareHouse = Delivered;

                    using (ProductRepository productRepository = new ProductRepository())
                    {
                        foreach (var delivered in Delivered)
                        {
                            Product deliveredProduct = productRepository.GetById(delivered.ProductId);
                            deliveredProduct.Amount += delivered.Amount;
                            productRepository.SaveChanges();
                        }
                    }

                    SupplyRepository.Add(CreatedSupply);
                    SupplyRepository.SaveChanges();
                    (View.Owner.DataContext as SupplyViewModel).Update();
                    View.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("Непредвиденная ошибка");
                }
            }
            else
            {
                MessageBox.Show("Таблица не может быть пустой или содержать нулевые значения");
            }
        }
 private void RemoveExecute()
 {
     SupplyRepository.RemoveById((View.DataSupplies.SelectedItem as Supply).Id);
     SupplyRepository.SaveChanges();
     Update();
 }