public RedirectToActionResult Remover(AdminPostagensRemoverRequestModel request)
        {
            var id = request.Id;

            try {
                _postagemOrmService.RemoverPostagem(id);
            } catch (Exception exception) {
                TempData["erro-msg"] = exception.Message;
                return(RedirectToAction("Remover", new { id = id }));
            }

            return(RedirectToAction("Listar"));
        }
Beispiel #2
0
        public RedirectToActionResult Remover(AdminPostagensRemoverRequestModel request)
        {
            var id          = request.Id;
            var numRevisoes = _revisaoOrmService.ObterRevisoesPorPostagem(id).Count;

            try
            {
                _revisaoOrmService.RemoverRevisoesPorPostagem(id);
                _postagemOrmService.RemoverPostagem(id);
            }
            catch (Exception e)
            {
                TempData["erro-msg"] = e.Message;
                return(RedirectToAction("Remover", new { id = id }));
            }

            return(RedirectToAction("Listar"));
        }