// Constructor public EditTransactionViewModel(TransactionHeadListEntity item, bool newRecord, string itemName) : base(item, newRecord, itemName) { TransactionDate = Item.Head.Date; this.TransactionBody.CollectionChanged += this.OnCollectionChanged; if (Item.Head.Id > 0) { var list = ManageTransactions.ListBody(Item.Head.Id); foreach (var record in list) { TransactionBody.Add(new BindableTransactionBodyListEntity(record)); } } if (Item.Head.Incoming) { Partners = ManagePartners.ListDealers(); } else { Partners = ManagePartners.ListCustomers(); } if (Item.Partner != null) { foreach (var record in Partners.Where(p => p.Id == Item.Partner.Id)) { SelectedPartner = record; } } SelectedProductCategory = new ProductCategoryEntity() { Category = " - All product categories - ", Id = 0 }; ProductCategories.Add(SelectedProductCategory); ProductCategories.AddRange(ManageProducts.ListProductCategories()); }
public void AddSeedData() { Customers.AddRange(new List <Customer> { new Customer { Name = "Marco Hernandez", Email = "*****@*****.**" } }); Categories.AddRange(new List <Category> { new Category { Name = "Action" }, new Category { Name = "Adventure" }, new Category { Name = "Puzzle" }, new Category { Name = "Horror" }, new Category { Name = "Adult" }, new Category { Name = "RPG" } }); Products.AddRange(new List <Product> { new Product { Name = "Destiny", Price = 40.00m }, new Product { Name = "Destiny 2", Price = 45.00m }, new Product { Name = "Resident Evil VII", Price = 60.00m }, new Product { Name = "Dead Space", Price = 15.00m }, new Product { Name = "Doom", Price = 30.00m }, new Product { Name = "Minecraft", Price = 12.00m }, }); ProductCategories.AddRange(new List <ProductCategory> { new ProductCategory { ProductId = 1, CategoryId = 1 }, new ProductCategory { ProductId = 1, CategoryId = 2 }, new ProductCategory { ProductId = 1, CategoryId = 6 }, new ProductCategory { ProductId = 2, CategoryId = 1 }, new ProductCategory { ProductId = 2, CategoryId = 2 }, new ProductCategory { ProductId = 2, CategoryId = 6 }, new ProductCategory { ProductId = 3, CategoryId = 3 }, new ProductCategory { ProductId = 3, CategoryId = 4 }, new ProductCategory { ProductId = 4, CategoryId = 2 }, new ProductCategory { ProductId = 4, CategoryId = 4 }, new ProductCategory { ProductId = 5, CategoryId = 1 }, new ProductCategory { ProductId = 5, CategoryId = 5 }, new ProductCategory { ProductId = 6, CategoryId = 2 }, new ProductCategory { ProductId = 6, CategoryId = 3 }, }); SaveChanges(); }