public ActionResult AddProductSubmit(Product product, List <int> imageIDs) { int productID = productFactory.Insert(product); if (imageIDs != null) { for (int i = 0; i < imageIDs.Count; i++) { Image img = imageFactory.Get(imageIDs[i]); img.ProductID = productID; imageFactory.Update(img); } } TempData["MSG"] = "A product has been added."; return(RedirectToAction("Products")); }