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