public ActionResult DelCategory(int Id) { CategoryGalleryDAO dao = new CategoryGalleryDAO(); dao.DelCategory(Id); return(Redirect("/Home/Gallery/")); }
public ActionResult AddGallery(string Category, string Name, string Folder, IEnumerable <HttpPostedFileBase> uploads) { CategoryGalleryDAO dao = new CategoryGalleryDAO(); ViewBag.Categories = dao.GetListCategories(); ViewBag.Count = dao.GetCountCategories(); var folder = Server.MapPath("~/Content/Gallery/" + Folder); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); foreach (var file in uploads) { if (file != null) { string filename = Path.GetFileName(file.FileName); file.SaveAs(Server.MapPath("~/Content/Gallery/" + Folder + "/" + filename)); } } GalleryDAO galleryDAO = new GalleryDAO(); galleryDAO.AddGallery(Category, Name, Folder, uploads); } else { ViewBag.Warning = "Галерея с таким именем уже существует!"; } return(View()); }
public ActionResult AddCategoryGallery(CategoryGallery category) { CategoryGalleryDAO dao = new CategoryGalleryDAO(); dao.AddCategory(category); return(View()); }
public ActionResult AddGallery() { CategoryGalleryDAO dao = new CategoryGalleryDAO(); ViewBag.Categories = dao.GetListCategories(); ViewBag.Count = dao.GetCountCategories(); return(View()); }
public ActionResult GalleryName(string id) { if (string.IsNullOrEmpty(id)) { return(Redirect("/Error/Http404")); } try { int cathId = Convert.ToInt32(id); CategoryGalleryDAO dao = new CategoryGalleryDAO(); var category = dao.GetCategoryId(cathId); if (category == null) { return(Redirect("/Error/Http404")); } return(View(category)); } catch (Exception) { return(Redirect("/Error/Http404")); } }
public ActionResult Gallery() { CategoryGalleryDAO dao = new CategoryGalleryDAO(); return(View(dao.GetListCategories())); }