public override System.Web.Mvc.ActionResult Edit(Models.HedarImage hedarImage) { var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "hedarImage", hedarImage); EditOverride(callInfo, hedarImage); return(callInfo); }
public virtual System.Web.Mvc.ActionResult Edit(System.Guid?id) { Models.HedarImage oHedarImage = UnitOfWork.HedarImageRepository.Get() .Where(current => current.Id == id) .FirstOrDefault() ; if (oHedarImage == null) { return(HttpNotFound()); } return(View(oHedarImage)); }
public virtual System.Web.Mvc.ActionResult DeleteConfirmed(System.Guid id) { Models.HedarImage oHedarImage = UnitOfWork.HedarImageRepository.Get() .Where(current => current.Id == id) .FirstOrDefault() ; UnitOfWork.HedarImageRepository.Delete(oHedarImage); UnitOfWork.Save(); return(RedirectToAction(MVC.HedarImage.Index())); }
public virtual System.Web.Mvc.ActionResult Edit(Models.HedarImage hedarImage) { hedarImage.UpdateDateTime = Infrastructure.Utility.Now; if (ModelState.IsValid) { if (Request.Files["FileName"].ContentLength > 0) { string type = Request.Files["FileName"].ContentType; string[] type2 = type.Split('/'); string fileType = string.Format("{0}{1}", ".", type2[1]); string extension = System.IO.Path.GetExtension(Request.Files["FileName"].FileName); string path1 = string.Format("{0}/{1}", Server.MapPath("~/Content/GalleryFiles/"), Request.Files["FileName"].FileName); string fileName = Path.GetFileName(path1); // ../../../Content/ImageGalery string path2 = string.Format("{0}/{1}", Server.MapPath("~/Content/GalleryFiles/"), fileName); string NameArticle = (Request.Files["FileName"].FileName); int FileLength = (Request.Files["FileName"].ContentLength); byte[] Buf = new byte[Request.Files["FileName"].ContentLength]; int Data = Request.Files["FileName"].InputStream.Read(Buf, 0, FileLength); if (FileLength > 100000000) { ModelState.AddModelError("Large File", "File Size is limited to 10mb"); } if (System.IO.File.Exists(path2)) { System.IO.File.Delete(path2); } Request.Files["FileName"].SaveAs(path2); hedarImage.FileName = fileName; UnitOfWork.HedarImageRepository.Update(hedarImage); UnitOfWork.Save(); return(RedirectToAction(MVC.HedarImage.Index())); } else { UnitOfWork.HedarImageRepository.Update(hedarImage); UnitOfWork.Save(); return(RedirectToAction(MVC.HedarImage.Index())); } } return(View(hedarImage)); }
partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.HedarImage hedarImage);