public ActionResult Create(GalleryEventPhoto galleryEventSingle) { if (galleryEventSingle.ImgFile.ContentLength > 0) { var fileNm = Path.GetFileName(galleryEventSingle.ImgFile.FileName); var saveArea = Path.Combine(Server.MapPath("~/Public/images"), fileNm); galleryEventSingle.ImgFile.SaveAs(saveArea); galleryEventSingle.Image = fileNm; db.galleryEventPhotos.Add(galleryEventSingle); db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Edit(GalleryEventPhoto galleryEventSingle) { db.Entry(galleryEventSingle).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }