Beispiel #1
0
 public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         service.Remover(id);
         return(RedirectToAction("Index"));
     }
     catch (BusinessException)
     {
         return(HttpNotFound());
     }
 }
Beispiel #2
0
        public async Task <IActionResult> DeleteConfirmed(Guid id)
        {
            var carroViewModel = await ObterCarro(id);

            if (carroViewModel == null)
            {
                return(NotFound());
            }
            await _carroService.Remover(id);

            if (!OperacaoValida())
            {
                return(View(carroViewModel));
            }

            TempData["Sucesso"] = "Carro excluido com sucesso!";

            return(RedirectToAction(nameof(Index)));
        }