public MainWindow() { InitializeComponent(); db = new StockDbEntities(); foreach (var item in db.Product.ToList()) { PList.Add(new ProductClass(item.Id, item.Capacity, item.MinCapacity, item.MaxCapacity, item.Price, item.Information, item.Units, item.TypeId, item.Title)); } Products.ItemsSource = PList; }
public ProductClass(int id, decimal capacity, int minc, int maxc, decimal price, String info, string units, int typeid, string title) { db = new StockDbEntities(); _id = id; _capacity = capacity; _mincapacity = minc; _maxcapacity = maxc; _price = price; _information = info; _units = units; _typeId = typeid; _title = title; }