public ClassViewModel() { AddCommand = new DelegateCommand(Add, canAdd); stacklist = new ObservableCollection <Product>(); data = new ProductDataLayer(); productlist = data.getallProducts(); }
public CatalogViewModel() { ProductDataLayer layer = new ProductDataLayer(); _produits = layer.GetAllButMenus(); AddToCart = new DelegateCommand <Produit>(DoAddToCart); }
public IHttpActionResult GetProduct(string name) { var product = ProductDataLayer.GetProducts().FirstOrDefault((p) => p.Name == name); if (product == null) { return(NotFound()); } return(Ok(product)); }
public IHttpActionResult Delete([FromUri] int id) { try { ProductDataLayer.DeleteProduct(id); return(Ok()); } catch (Exception ex) { return(new ErrorMessage(ex, HttpStatusCode.InternalServerError, Request)); } }
public IHttpActionResult AddProduct([FromBody] ProductFilterViewModel obj) { try { ProductDataLayer.AddProduct(obj); return(Ok()); } catch (Exception ex) { return(new ErrorMessage(ex, HttpStatusCode.InternalServerError, Request)); } }
public Menu2Items(TypeFormule type) { InitializeComponent(); MenuViewModel vm = new MenuViewModel(); this.DataContext = vm; vm.menu.Type = type; ProductDataLayer layer = new ProductDataLayer(); this.ComboDrink.ItemsSource = layer.GetAllOneType(TypeMenu.Boisson, type); this.ComboDessert.ItemsSource = layer.GetAllOneType(TypeMenu.Dessert, type); vm.RedirectEvent += (redirectTo) => this.NavigationService.Navigate(redirectTo); }
public IEnumerable <Product> GetAllProducts() { return(ProductDataLayer.GetProducts()); }
public AccueilViewModel() { ProductDataLayer layer = new ProductDataLayer(); _topThree = layer.GetTop3(); }
public ObservableCollection <Product> GetAllProducts() { ProductDataLayer data = new ProductDataLayer(); return(productlist = data.getallProducts()); }
public bool DeleteProduct(int id) { ProductDataLayer data = new ProductDataLayer(); return(data.DeleteProductData(id)); }
public bool AddProduct(Product p) { ProductDataLayer data = new ProductDataLayer(); return(data.AddProductData(p)); }