public override System.Web.Mvc.ActionResult Edit(Models.Advertizment advertizment) { var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "advertizment", advertizment); EditOverride(callInfo, advertizment); return(callInfo); }
public virtual System.Web.Mvc.ActionResult Edit(System.Guid?id) { Models.Advertizment oAdvertizment = UnitOfWork.AdvertizmentRepository.Get() .Where(current => current.Id == id) .FirstOrDefault() ; if (oAdvertizment == null) { return(HttpNotFound()); } return(View(oAdvertizment)); }
public virtual System.Web.Mvc.ActionResult DeleteConfirmed(System.Guid id) { Models.Advertizment oAdvertizment = UnitOfWork.AdvertizmentRepository.Get() .Where(current => current.Id == id) .FirstOrDefault() ; UnitOfWork.AdvertizmentRepository.Delete(oAdvertizment); UnitOfWork.Save(); return(RedirectToAction(MVC.Advertizment.Index())); }
public virtual System.Web.Mvc.ActionResult Edit(Models.Advertizment advertizment) { advertizment.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); advertizment.FileName = fileName; UnitOfWork.AdvertizmentRepository.Update(advertizment); UnitOfWork.Save(); return(RedirectToAction(MVC.Advertizment.Index())); } else { UnitOfWork.AdvertizmentRepository.Update(advertizment); UnitOfWork.Save(); return(RedirectToAction(MVC.Advertizment.Index())); } } return(View(advertizment)); }
partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.Advertizment advertizment);