public ActionResult AlterarBanner(Banner banner, HttpPostedFileBase file, string AntigoBanner) { MultimidiaFacade facade = new MultimidiaFacade(); try { facade.SalvarBanner(banner, file, AntigoBanner); return RedirectToAction("Index"); } catch { string[] filePaths = Directory.GetFiles(Server.MapPath("~/AppData/Banner/")); for (int i = 0; i < filePaths.Length; i++) { filePaths[i] = Path.GetFileName(filePaths[i]); } List<string> listString = filePaths.ToList<string>(); listString.Insert(0, ""); SelectList list = new SelectList(listString); ViewBag.Arquivos = list; ViewData["Locais"] = new SelectList(facade.PesquisarLocal(null), "Codigo", "Descricao"); return View(banner); } }
public ActionResult CadastrarBanner(Banner banner, HttpPostedFileBase file) { MultimidiaFacade facade = new MultimidiaFacade(); try { facade.SalvarBanner(banner, file); return RedirectToAction("Index"); } catch { ViewData["Locais"] = new SelectList(facade.PesquisarLocal(null), "Codigo", "Descricao"); return View(banner); } }