public ActionResult Edit(Guitar guitar, HttpPostedFileBase image = null) { if (ModelState.IsValid) { if (image != null) { guitar.ImageMimeType = image.ContentType; guitar.ImageData = new byte[image.ContentLength]; image.InputStream.Read(guitar.ImageData, 0, image.ContentLength); repository.SaveProduct(guitar, true); } else { repository.SaveProduct(guitar, false); } TempData["message"] = string.Format("Изменения в товаре \"{0}\" были сохранены", guitar.Name); return(RedirectToAction("Index")); } else { return(View(guitar)); } }