Пример #1
0
 public ActionResult Edit(Mobile mobile, HttpPostedFileBase image = null)
 {
     if (ModelState.IsValid)
     {
         if (image != null)
         {
             mobile.ImageMimeType = image.ContentType;
             mobile.ImageData     = new byte[image.ContentLength];
             image.InputStream.Read(mobile.ImageData, 0, image.ContentLength);
         }
         repository.SaveMobile(mobile);
         TempData["message"] = string.Format("Changes in \"{0}\" were saved", mobile.Name);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(mobile));
     }
 }