public ActionResult Create(Guid id, ContentSlideModel data) { ContentSlideshow show = new ContentSlideshow(id); if (Request.Files["SlideImageFile"].HasFile()) { string baseDirectory = Server.MapPath("/assets/images/slideshow/"); if (!Directory.Exists(baseDirectory)) { Directory.CreateDirectory(baseDirectory); } baseDirectory += id.ToString() + "/"; if (!Directory.Exists(baseDirectory)) { Directory.CreateDirectory(baseDirectory); } string FileName = tksUtil.MakeValidFileName(Request.Files["SlideImageFile"].FileName).ToLower(); // Save image file to the retrieved directory Request.Files["SlideImageFile"].SaveAs(Path.Combine(baseDirectory, FileName)); data.SlideImageFile = FileName; data.ModuleID = id; } int SlideSerial = show.Add(data); return(RedirectToAction("Index", new { id = data.ModuleID })); }
// GET: Admin/ContentSlideshow/<ModuleID> public ActionResult Index(Guid id) { ContentSlideshow set = new ContentSlideshow(id); PageModule module = new PageModule(id); ViewBag.Locale = module.Locale; ViewBag.URL = module.VirtualPath; ViewBag.PageID = module.PageID; ViewBag.PageSectionName = module.PageSectionName; ViewBag.ModuleTypeName = module.ModuleTypeName; ViewBag.ModuleName = module.ModuleName; ViewBag.ModuleID = module.ModuleID; return(View(set.AllSlides())); }