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); }
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")); }
public void OnGet(int id) { Product = ProductsDB.GetProduct(id, _configuration); }
public void OnGet(int id) { Product = ProductsDB.GetProduct(id, _configuration); Category = CategoriesDB.GetCategory(Product.IdCategory, _configuration); }
public void OnGet(int id) { OldProduct = ProductsDB.GetProduct(id, _configuration); ProductDescription = OldProduct.Description; }