public ActionResult GalleryDetails(int id) { DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository(); gallery _gallery = GalleryRepo.SelectOne(id); return(View(_gallery)); }
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()); } }
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()); } }
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()); } }
public ActionResult GalleryDelete(int id) { DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository(); return(View(GalleryRepo.SelectOne(id))); }
public ActionResult Gallery() { DAL.GalleryDAL.GalleryRepository GalleryRepo = new DAL.GalleryDAL.GalleryRepository(); return(View(GalleryRepo.SelectAll())); }