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); }
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); }