Example #1
0
        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));
            }
        }
Example #2
0
        //
        // GET: /ManterBanner/CadastrarBanner
        public ActionResult CadastrarBanner()
        {
            MultimidiaFacade facade = new MultimidiaFacade();

            ViewData["Locais"] = new SelectList(facade.PesquisarLocal(null), "Codigo", "Descricao");
            return(View());
        }
Example #3
0
        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));
            }
        }
Example #4
0
        //
        // GET: /ManterBanner/AlterarBanner/5
        public ActionResult AlterarBanner(int Codigo)
        {
            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;

            MultimidiaFacade facade = new MultimidiaFacade();
            Banner           banner = facade.PesquisarBanner(Codigo);

            ViewData["Locais"] = new SelectList(facade.PesquisarLocal(null), "Codigo", "Descricao");
            return(View(banner));
        }