Esempio n. 1
0
        public void UpdateGalleryDetail(GalleryDetail galleryDetail)
        {
            var gd = GetGalleryDetail(galleryDetail.GalleryID, galleryDetail.PictureFile);

            gd.PictureTitle = galleryDetail.PictureTitle;
            gd.SortOrder    = galleryDetail.SortOrder;
        }
Esempio n. 2
0
        //  Gallery Detail

        public void InsertGalleryDetail(GalleryDetail galleryDetail, HttpPostedFileBase file)
        {
            if (file != null)
            {
                UploadGalleryPicture(galleryDetail, file);
                db.GalleryDetails.Add(galleryDetail);
            }
        }
Esempio n. 3
0
        public void DeleteGalleryDetail(GalleryDetail galleryDetail)
        {
            var gd = GetGalleryDetail(galleryDetail.GalleryID, galleryDetail.PictureFile);

            Hammer.Common.IO.DeleteFile(gd.PictureFolder, gd.PictureFile);

            db.GalleryDetails.Remove(gd);
        }
Esempio n. 4
0
 public ActionResult AddGalleryDetail(GalleryDetail galleryDetail, HttpPostedFileBase file)
 {
     if (file != null)
     {
         socialService.InsertGalleryDetail(galleryDetail, file);
         socialService.Save();
     }
     return(RedirectToAction("GalleryDetails", new { id = galleryDetail.GalleryID }));
 }
Esempio n. 5
0
        // 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);
        }
Esempio n. 6
0
        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 }));
        }