Exemple #1
0
        public IActionResult Edit(long ProductID)
        {
            ViewBag.PageName = "Edit";
            CoffeeTable prod = CoffeeTable.Read(ProductID);

            ViewBag.ProductID          = prod.ProductID;
            ViewBag.ProductName        = prod.ProductName;
            ViewBag.ProductDescription = prod.Description;
            ViewBag.ProductPrice       = prod.Price;
            ViewBag.ProductCategory    = prod.Category;
            return(View("Add"));
        }
Exemple #2
0
        public IActionResult Delete(long ProductID)
        {
            //IDbConnection db = new SqlConnection("Server=GWJSN13\\SQLEXPRESS; Database=Coffee2; user id=admin; password=pass1;");
            //db.Open();
            //CoffeeTable.Delete(ProductID);
            //db.Close();
            //return View("Add");

            CoffeeTable.Read(ProductID);
            CoffeeTable.Delete(ProductID);
            return(View("Delete"));
        }
Exemple #3
0
        public IActionResult SaveNew(long productID, string productName, string productDescription, decimal productPrice, string productCategory)
        {
            if (productID >= 1)
            {
                CoffeeTable.Update(productID, productName, productDescription, productPrice, productCategory);
            }
            else
            {
                CoffeeTable.Create(productName, productDescription, productPrice, productCategory);
            }

            ViewBag.Message = "The Product has been saved.";
            List <CoffeeTable> prod = CoffeeTable.Read();

            return(View("Index", prod));
        }
Exemple #4
0
        //public IActionResult Index()
        //{
        //    List<CoffeeTable> prod = CoffeeTable.Read();
        //    return View(prod);
        //}

        public ActionResult Test()
        {
            List <CoffeeTable> prod = CoffeeTable.Read();

            return(View(prod));
        }