Ejemplo n.º 1
0
        public ActionResult UpdateProduct(int id)
        {
            ManiProductsViewModel model = new ManiProductsViewModel()
            {
                Product    = _productManager.GetProduct(id),
                Categories = _categoryManager.GetCategories(),
                ButtonName = "Update Product",
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult AddNewProduct()
        {
            ManiProductsViewModel model = new ManiProductsViewModel()
            {
                Product    = new Product(),
                Categories = _categoryManager.GetCategories(),
                ButtonName = "Add Product"
            };

            return(View(model));
        }
Ejemplo n.º 3
0
 public ActionResult UpdateProduct(Product product)
 {
     if (!ModelState.IsValid)
     {
         ManiProductsViewModel model = new ManiProductsViewModel
         {
             Product    = _productManager.GetProduct(product.ProductID),
             Categories = _categoryManager.GetCategories(),
             ButtonName = "Update Product",
         };
         return(View(model));
     }
     _productManager.UpdateProduct(product);
     TempData["message"] = "Ürün Güncellendi";
     return(RedirectToAction("ProductManiPage"));
 }
Ejemplo n.º 4
0
 public ActionResult AddNewProduct(Product product)
 {
     if (!ModelState.IsValid)
     {
         ManiProductsViewModel model = new ManiProductsViewModel
         {
             Product    = new Product(),
             Categories = _categoryManager.GetCategories(),
             ButtonName = "Add Product"
         };
         return(View(model));
     }
     _productManager.AddProduct(product);
     TempData["message"] = "Yeni ürün eklendi";
     return(RedirectToAction("ProductManiPage"));
 }