public void UpdateGalleryDetail(GalleryDetail galleryDetail) { var gd = GetGalleryDetail(galleryDetail.GalleryID, galleryDetail.PictureFile); gd.PictureTitle = galleryDetail.PictureTitle; gd.SortOrder = galleryDetail.SortOrder; }
// Gallery Detail public void InsertGalleryDetail(GalleryDetail galleryDetail, HttpPostedFileBase file) { if (file != null) { UploadGalleryPicture(galleryDetail, file); db.GalleryDetails.Add(galleryDetail); } }
public void DeleteGalleryDetail(GalleryDetail galleryDetail) { var gd = GetGalleryDetail(galleryDetail.GalleryID, galleryDetail.PictureFile); Hammer.Common.IO.DeleteFile(gd.PictureFolder, gd.PictureFile); db.GalleryDetails.Remove(gd); }
public ActionResult AddGalleryDetail(GalleryDetail galleryDetail, HttpPostedFileBase file) { if (file != null) { socialService.InsertGalleryDetail(galleryDetail, file); socialService.Save(); } return(RedirectToAction("GalleryDetails", new { id = galleryDetail.GalleryID })); }
// Upload picture public void UploadGalleryPicture(GalleryDetail galleryDetail, HttpPostedFileBase file) { string filename = string.Format("{0}-{1}", galleryDetail.PictureTitle, file.FileName); // delete to overwrite Hammer.Common.IO.DeleteFile(galleryDetail.PictureFolder, galleryDetail.PictureFile); // update filename galleryDetail.PictureFile = filename; Hammer.Common.IO.UploadImageFile(file.InputStream, galleryDetail.PictureFolder, galleryDetail.PictureFile, 800); }
public ActionResult EditGalleryDetail(GalleryDetail galleryDetail, HttpPostedFileBase file) { if (file != null) { var gd = socialService.GetGalleryDetail(galleryDetail.GalleryID, galleryDetail.PictureFile); socialService.DeleteGalleryDetail(gd); socialService.InsertGalleryDetail(galleryDetail, file); socialService.Save(); } else { //socialService.UpdateGalleryDetail(galleryDetail, file); socialService.UpdateGalleryDetail(galleryDetail); socialService.Save(); } return(RedirectToAction("GalleryDetails", new { id = galleryDetail.GalleryID })); }