public IActionResult DeleteConfirmed(int id) { var _ctxCupcakeToDelete = _repository.GetCupcakeById(id); //_repository.DeleteCupcake(_ctxCupcakeToDelete.CupcakeId); _repository.DeleteCupcake(id); return(RedirectToAction(nameof(Index))); }
public IActionResult DeleteConfirmed(int id) { try { _repository.DeleteCupcake(id); } catch (InvalidOperationException) { return(NotFound()); } return(RedirectToAction(nameof(Index))); }
public IActionResult DeleteConfirmed(int id) { _repository.DeleteCupcake(id); return(RedirectToAction(nameof(Index))); }