Beispiel #1
0
        public void ProductsDbGetProductReturnsProductAndInt()
        {
            //Assign
            var productsDb = new ProductsDB();
            var product    = new Product();

            productsDb.AddProduct(product);
            //Act + Assert
            Assert.AreEqual(productsDb.GetProduct(product.Name).Item1, product);
        }
Beispiel #2
0
        public IActionResult OnPost()
        {
            int click = Int32.Parse(Request.Form["click"]);

            if (click == 1)
            {
                Product = ProductsDB.GetProduct(Product.Id, _configuration);
                string currentShoppingCart = Request.Cookies["ShoppingCart"];
                string newShoppingCart     = ShoppingCartCookie.AddProduct(Product, currentShoppingCart);
                var    cookieOptions       = new CookieOptions {
                    Expires = DateTime.Now.AddDays(1)
                };
                Response.Cookies.Append("ShoppingCart", newShoppingCart, cookieOptions);
            }
            return(RedirectToPage("/Index"));
        }
Beispiel #3
0
 public void OnGet(int id)
 {
     Product = ProductsDB.GetProduct(id, _configuration);
 }
Beispiel #4
0
 public void OnGet(int id)
 {
     Product  = ProductsDB.GetProduct(id, _configuration);
     Category = CategoriesDB.GetCategory(Product.IdCategory, _configuration);
 }
Beispiel #5
0
 public void OnGet(int id)
 {
     OldProduct         = ProductsDB.GetProduct(id, _configuration);
     ProductDescription = OldProduct.Description;
 }