// GET: VpnController/Delete/5 public IActionResult DeleteConfirmation(int id) { if (id < 0) { return(NotFound()); } var _vpn = _vpnRepo.GetById(id); if (_vpn == null) { return(NotFound()); } DeleteVpnViewModel vpn = _mapper.Map <DeleteVpnViewModel>(_vpn); return(PartialView("_DeleteConfirmation", vpn)); }
public IActionResult Delete(DeleteVpnViewModel _vpn) { try { if (_vpn == null) { return(NotFound()); } var vpn = _vpnRepo.GetById(_vpn.Id); if (vpn == null) { return(NotFound()); } _vpnRepo.Delete(vpn); return(RedirectToAction(nameof(Index))); } catch { return(RedirectToAction(nameof(Index))); } }