public ActionResult Criar(Photo photo, HttpPostedFileBase Image) { photo.CreateAt = DateTime.Now; photo.ModifiedAt = DateTime.Now; photo.User = User.Identity.Name; if (ModelState.IsValid) { if (Image != null) { photo.MimeType = Image.ContentType; photo.File = new byte[Image.ContentLength]; Image.InputStream.Read(photo.File, 0, Image.ContentLength); photoRepository.Adicionar(photo); } return(RedirectToAction("Index")); } return(View()); }