Пример #1
0
 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"));
 }
Пример #2
0
 public ActionResult Edit(GalleryInteriorPhoto galleryInteriorPhotosingle)
 {
     db.Entry(galleryInteriorPhotosingle).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }