Exemple #1
0
        public ActionResult ConfirmarExcluir(long id)
        {
            var aviso = _servicoAviso.ObterPeloId(id);

            if (aviso == null)
            {
                return HttpNotFound();
            }

            try
            {
                _servicoAviso.Excluir(aviso);
                Success(Alerts.Success, true);

                return RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                Erro(Alerts.Erro, true, exception);
            }

            var model = new AvisoEditModel
            {
                Id = aviso.Id,
                Texto = aviso.Texto
            };

            return View(model);
        }
Exemple #2
0
        public ActionResult Excluir(long? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var aviso = _servicoAviso.ObterPeloId(id.Value);

            if (aviso == null)
            {
                return HttpNotFound();
            }

            var model = new AvisoEditModel
            {
                Id = aviso.Id,
                Texto = aviso.Texto
            };

            return View(model);
        }