Exemple #1
0
        public ActionResult GalleryDetails(int id)
        {
            DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository();
            gallery _gallery = GalleryRepo.SelectOne(id);

            return(View(_gallery));
        }
Exemple #2
0
        public ActionResult GalleryEdit(gallery _gallery, HttpPostedFileBase fileUpload, FormCollection collection)
        {
            try
            {
                if (collection["removeImage"] != null && Convert.ToBoolean(collection["removeImage"].Split(',')[0]))
                {
                    _gallery.Directory = "";
                    if ((System.IO.File.Exists(Server.MapPath("~") + _gallery.Directory)))
                    {
                        System.IO.File.Delete(Server.MapPath("~") + _gallery.Directory);
                    }
                }

                if (fileUpload != null)
                {
                    _gallery.Directory = DAL.DatabaseHelper.UploadFile(DataSettings.GALLERY_DIRECTORY, fileUpload, Server);
                }

                DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository();
                GalleryRepo.Update(_gallery, Server.MapPath("~"));

                return(RedirectToAction("Gallery"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #3
0
        public ActionResult GalleryDelete(int id, gallery _gallery)
        {
            try
            {
                DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository();
                GalleryRepo.Delete(id, Server.MapPath("~"));

                return(RedirectToAction("Gallery"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #4
0
        public ActionResult GalleryCreate(gallery _gallery, HttpPostedFileBase fileUpload, FormCollection collection)
        {
            try
            {
                if (fileUpload != null)
                {
                    _gallery.Directory = DAL.DatabaseHelper.UploadFile(DataSettings.GALLERY_DIRECTORY, fileUpload, Server);
                }

                DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository();
                GalleryRepo.Insert(_gallery);

                return(RedirectToAction("Gallery"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #5
0
 public ActionResult GalleryDelete(int id)
 {
     DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository();
     return(View(GalleryRepo.SelectOne(id)));
 }
Exemple #6
0
 public ActionResult Gallery()
 {
     DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository();
     return(View(GalleryRepo.SelectAll()));
 }