public ActionResult Edit(Thing thing) { if (ModelState.IsValid) { repository.SaveThing(thing); TempData["message"] = string.Format("Изменение информации о вещи \"{0}\" сохранены", thing.Name); return(RedirectToAction("Index")); } else { return(View(thing)); } }
public ActionResult Edit(Thing thing, HttpPostedFileBase image = null) { if (ModelState.IsValid) { if (image != null) { thing.ImageMimeType = image.ContentType; thing.ImageData = new byte[image.ContentLength]; image.InputStream.Read(thing.ImageData, 0, image.ContentLength); } repository.SaveThing(thing); TempData["message"] = string.Format("Changing \"{0}\" was saved", thing.Name); return(RedirectToAction("Index")); } else { return(View(thing)); } }