public override void Execute(object parameter) { var storageCardSupplier = new StorageCardSupplier { DateTime = DateTime.Now, StorageCard = this.SuppliersViewModel.DatabaseHelper.GetStorageCard(this.SuppliersViewModel.SelectedStorageCard.Id), Supplier = (Supplier)parameter, }; this.SuppliersViewModel.DatabaseHelper.Add(storageCardSupplier); this.SuppliersViewModel.DatabaseHelper.SaveChanges(); this.SuppliersViewModel.LoadSuppliersAsync(); this.SuppliersViewModel.LastActionStatus = "Dodavatel byl vybrán."; }
private void AddTestData() { var account1 = new Account { DateTime = this.dateTime, Name = "account1" }; var account2 = new Account { DateTime = this.dateTime, Name = "account2" }; var account3 = new Account { DateTime = this.dateTime, Name = "account3" }; var category1 = new Category { DateTime = this.dateTime, Name = "category1" }; var category2 = new Category { DateTime = this.dateTime, Name = "category2" }; var category3 = new Category { DateTime = this.dateTime, Name = "category3" }; var customer1 = new Customer { DateTime = this.dateTime, Name = "customer1" }; var customer2 = new Customer { DateTime = this.dateTime, Name = "customer2" }; var customer3 = new Customer { DateTime = this.dateTime, Name = "customer3" }; var store1 = new Store { DateTime = this.dateTime, Name = "store1" }; var store2 = new Store { DateTime = this.dateTime, Name = "store2" }; var store3 = new Store { DateTime = this.dateTime, Name = "store3" }; var supplier1 = new Supplier { DateTime = this.dateTime, Name = "supplier1" }; var supplier2 = new Supplier { DateTime = this.dateTime, Name = "supplier2" }; var supplier3 = new Supplier { DateTime = this.dateTime, Name = "supplier3" }; var storageCard1 = new StorageCard { DateTime = this.dateTime, Name = "storageCard1", Account = account1, Category = category1, Store = store1, }; var storageCard2 = new StorageCard { DateTime = this.dateTime, Name = "storageCard2", Account = account2, Category = category2, Store = store2, }; var storageCard3 = new StorageCard { DateTime = this.dateTime, Name = "storageCard3", Account = account3, Category = category3, Store = store3, }; var storageCardSupplier1 = new StorageCardSupplier { DateTime = this.dateTime, StorageCard = storageCard1, Supplier = supplier1, }; var storageCardSupplier2 = new StorageCardSupplier { DateTime = this.dateTime, StorageCard = storageCard2, Supplier = supplier1, }; var storageCardSupplier3 = new StorageCardSupplier { DateTime = this.dateTime, StorageCard = storageCard2, Supplier = supplier2, }; var storageCardSupplier4 = new StorageCardSupplier { DateTime = this.dateTime, StorageCard = storageCard3, Supplier = supplier1, }; var storageCardSupplier5 = new StorageCardSupplier { DateTime = this.dateTime, StorageCard = storageCard3, Supplier = supplier2, }; var storageCardSupplier6 = new StorageCardSupplier { DateTime = this.dateTime, StorageCard = storageCard3, Supplier = supplier3, }; var item1 = new Item { DateTime = this.dateTime, Name = "item1", Movement = 1, Qty = 1, Price = 1, Invoice = "invoice1", StorageCard = storageCard1, Customer = customer1, }; this.context.AddRange( account1, account2, account3, category1, category2, category3, customer1, customer2, customer3, store1, store2, store3, supplier1, supplier2, supplier3, storageCard1, storageCard2, storageCard3, storageCardSupplier1, storageCardSupplier2, storageCardSupplier3, storageCardSupplier4, storageCardSupplier5, storageCardSupplier6, item1); this.context.SaveChanges(); }
public void DeleteStorageCardSupplier(StorageCardSupplier storageCardSupplier) { this.databaseContext.StorageCardSuppliers.Remove(storageCardSupplier); }