public int DeleteCert(int certId) { try { return(certRepository.DeleteCert(certId)); } catch (Exception ex) { throw ex; } }
public IActionResult DeleteCert(int certId, string certPath) { if (System.IO.File.Exists(_appEnv.WebRootPath + certPath)) { System.IO.File.Delete(_appEnv.WebRootPath + certPath); } Certificate deleteCert = repositoryCert.DeleteCert(certId); if (deleteCert != null) { TempData["message"] = $"{deleteCert.CertName} was deleted"; } return(RedirectToAction("EditCert", new { staffId = deleteCert.StaffId })); }