Пример #1
0
        public ActionResult Editar(FonteViewModel fonte)
        {
            if (!ModelState.IsValid)
                return View(fonte);

            var fonteSalvar = new Fonte
            {
                Id = fonte.Id,
                Nome = fonte.Nome
            };

            fonteApp.Salvar(fonteSalvar);
            this.Flash("Fonte Salva com Sucesso!");
            return RedirectToAction("Index");
        }
Пример #2
0
        public ActionResult Editar(FonteViewModel fonte)
        {
            if (!ModelState.IsValid)
            {
                return(View(fonte));
            }

            var fonteSalvar = new Fonte
            {
                Id   = fonte.Id,
                Nome = fonte.Nome
            };

            fonteApp.Salvar(fonteSalvar);
            this.Flash("Fonte Salva com Sucesso!");
            return(RedirectToAction("Index"));
        }
Пример #3
0
        public ActionResult Editar(string id)
        {
            if (string.IsNullOrEmpty(id))
                return View(new FonteViewModel());

            var fonte = fonteApp.ListarPorId(id);
            if (fonte == null)
            {
                this.Flash("Fonte não encontrada!", FlashEnum.Error);
                return View(new FonteViewModel());
            }

            var fonteViewModel = new FonteViewModel()
            {
                Id = fonte.Id,
                Nome = fonte.Nome
            };

            return View(fonteViewModel);
        }
Пример #4
0
        public ActionResult Editar(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(View(new FonteViewModel()));
            }

            var fonte = fonteApp.ListarPorId(id);

            if (fonte == null)
            {
                this.Flash("Fonte não encontrada!", FlashEnum.Error);
                return(View(new FonteViewModel()));
            }

            var fonteViewModel = new FonteViewModel()
            {
                Id   = fonte.Id,
                Nome = fonte.Nome
            };

            return(View(fonteViewModel));
        }