public async Task <ActionResult> Delete(int id, string name) { try { string uploadsFolder = Path.Combine(_webHostEnvironment.WebRootPath, "ChampionsImage"); string filePath = Path.Combine(uploadsFolder, name.Trim() + ".PNG"); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } var result = await _services.ChampionDelete(id); if (!result.RESULT) { return(RedirectToAction("ErrorPage")); } return(RedirectToAction("Index")); } catch { return(RedirectToAction("ErrorPage")); } }