Ejemplo n.º 1
0
 public ActionResult Edit(Product product)
 {
     if (ModelState.IsValid)
     {
         productData.Edit(product);
         return(RedirectToAction("Index"));
     }
     ViewBag.TypeId   = new SelectList(typeData.GetAll(), "TypeId", "Name", product.TypeId);
     ViewBag.AuthorId = new SelectList(authorData.GetAll(), "AuthorId", "AuthorName", product.AuthorId);
     return(View(product));
 }
Ejemplo n.º 2
0
        public IActionResult Edit(Product product)
        {
            if (_productData.GetProductById(product.Id) == null)
            {
                return(NotFound());
            }

            _productData.Edit(product);


            _productData.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public IActionResult EditLaptop(ManagerProductViewModel viewModel)
 {
     _ProductData.Edit(viewModel.Laptop);
     return(RedirectToAction("Index"));
 }