public ModelProduct MakeModelProduct(Service.Product product) { DataProvider dp = new DataProvider(); ModelProduct modelProduct = new ModelProduct(); modelProduct.Name = product.Name; modelProduct.Image = dp.GetImageFromByte(product.MainImage); modelProduct.Description = product.Description; return(modelProduct); }
public LibraryViewModel(List <Service.Product> products) { List <ModelProduct> modelProducts = new List <ModelProduct>(); foreach (Service.Product product in products) { ModelProduct modelProduct = new ModelProduct(); modelProducts.Add(modelProduct.MakeModelProduct(product)); } LibraryItems = CollectionViewSource.GetDefaultView(modelProducts); LibraryItems.Filter = FilterProductLibrary; }
public ProductViewModel() { List <ModelProduct> modelProducts = new List <ModelProduct>(); List <Service.Product> products = ShopWindows.client.GetProductTable().ToList(); foreach (Service.Product product in products) { ModelProduct modelProduct = new ModelProduct(); modelProducts.Add(modelProduct.MakeModelProduct(product)); } Items = CollectionViewSource.GetDefaultView(modelProducts); Items.Filter = FilterProduct; }
private void Window_Loaded(object sender, RoutedEventArgs e) { imagesmaets = Environment.CurrentDirectory + @"\Content\"; searchproduct.Focus(); foreach (Service.Product produc in products) { ModelProduct mp = new ModelProduct(); mp = mp.MakeModelProduct(produc); Lvm.Items.Add(mp); } foreach (Service.Profile produc in profilesq) { ModelProfile mp = new ModelProfile(); mp = mp.MakeModelProfile(produc); AllUser.Items.Add(mp); } Lvm.Visibility = Visibility.Hidden; }
private void FilterProductText_TextChanged(object sender, TextChangedEventArgs e) { if (FilterProductText.Text != "") { Lvm.Items.Clear(); w = client.GetProductByFilter(FilterProductText.Text).ToList(); foreach (Service.Product produc in w) { ModelProduct mp = new ModelProduct(); mp = mp.MakeModelProduct(produc); Lvm.Items.Add(mp); } } else { Lvm.Items.Clear(); foreach (Service.Product produc in products) { ModelProduct mp = new ModelProduct(); mp = mp.MakeModelProduct(produc); Lvm.Items.Add(mp); } } }