public ActionResult EditProducts(ProductVM productVM) { ProductRepo productRepo = new ProductRepo(); ProductVM editedProductVM = new ProductVM(); if (ModelState.IsValid) { editedProductVM = productRepo.UpdateProduct(productVM); return RedirectToAction("AdminOnly"); } else { ViewBag.ErrorMessage = "This entry is invalid."; return View(productVM); } }
public ActionResult EditProducts(int id) { ProductRepo productRepo = new ProductRepo(); ProductVM productVM = new ProductVM(); productVM = productRepo.GetProductDetail(id); return View(productVM); }
public ActionResult DeleteOrderProduct(int id, int productId) { ProductRepo productRepo = new ProductRepo(); if (ModelState.IsValid) { productRepo.DeleteOrderProduct(id,productId); } return RedirectToAction("DetailsOrderProduct", new { id = id }); }
public ActionResult EditOrderProduct(OrderProductVM orderProductVM) { ProductRepo productRepo = new ProductRepo(); OrderProductVM editedOrderProductVM = new OrderProductVM(); if (ModelState.IsValid) { editedOrderProductVM = productRepo.UpdateOrderProduct(orderProductVM); return RedirectToAction("DetailsOrderProduct", new { id = orderProductVM.OrderNumber }); } else { ViewBag.ErrorMessage = "This entry is invalid."; return View(orderProductVM); } }
public ActionResult EditOrderProduct(int id,int productId) // "id" is "id order number". { ProductRepo productRepo = new ProductRepo(); OrderProductVM orderProductVM = new OrderProductVM(); orderProductVM = productRepo.GetOrderProductDetail(id, productId); return View(orderProductVM); }
// Returning order's details public ActionResult DetailsOrderProduct(int id) { ProductRepo productRepo = new ProductRepo(); return View(productRepo.GetDetail(id)); }