public ActionResult EditProduct(Product product, HttpPostedFileBase image) { if (!ModelState.IsValid) { return(View(product)); } if (image != null) { //Stores image to a temporary location image.SaveAs(Server.MapPath(EFBusinessLogicLayer.TempImagePath)); //Generates a new guid for naming bigger and smaller pictures of the product product.ImageGuid = Guid.NewGuid(); } businessLayer.SaveProduct(product); TempData["message"] = string.Format("{0} was successfully updated", product.Name); return(RedirectToAction("GetCategories", "Admin")); }