Пример #1
0
 public ClassViewModel()
 {
     AddCommand  = new DelegateCommand(Add, canAdd);
     stacklist   = new ObservableCollection <Product>();
     data        = new ProductDataLayer();
     productlist = data.getallProducts();
 }
Пример #2
0
        public CatalogViewModel()
        {
            ProductDataLayer layer = new ProductDataLayer();

            _produits = layer.GetAllButMenus();
            AddToCart = new DelegateCommand <Produit>(DoAddToCart);
        }
Пример #3
0
        public IHttpActionResult GetProduct(string name)
        {
            var product = ProductDataLayer.GetProducts().FirstOrDefault((p) => p.Name == name);

            if (product == null)
            {
                return(NotFound());
            }
            return(Ok(product));
        }
Пример #4
0
 public IHttpActionResult Delete([FromUri] int id)
 {
     try
     {
         ProductDataLayer.DeleteProduct(id);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(new ErrorMessage(ex, HttpStatusCode.InternalServerError, Request));
     }
 }
Пример #5
0
 public IHttpActionResult AddProduct([FromBody] ProductFilterViewModel obj)
 {
     try
     {
         ProductDataLayer.AddProduct(obj);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(new ErrorMessage(ex, HttpStatusCode.InternalServerError, Request));
     }
 }
Пример #6
0
        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);
        }
Пример #7
0
 public IEnumerable <Product> GetAllProducts()
 {
     return(ProductDataLayer.GetProducts());
 }
Пример #8
0
        public AccueilViewModel()
        {
            ProductDataLayer layer = new ProductDataLayer();

            _topThree = layer.GetTop3();
        }
Пример #9
0
        public ObservableCollection <Product> GetAllProducts()
        {
            ProductDataLayer data = new ProductDataLayer();

            return(productlist = data.getallProducts());
        }
Пример #10
0
        public bool DeleteProduct(int id)
        {
            ProductDataLayer data = new ProductDataLayer();

            return(data.DeleteProductData(id));
        }
Пример #11
0
        public bool AddProduct(Product p)
        {
            ProductDataLayer data = new ProductDataLayer();

            return(data.AddProductData(p));
        }