// GET: Admin/Shop/DeleteProduct/id public ActionResult DeleteProduct(int id) { // Delete product from DB shopBL.DeleteProduct(id); // Delete product folder var originalDirectory = new DirectoryInfo(string.Format("{0}Images\\Uploads", Server.MapPath(@"\"))); string pathString = Path.Combine(originalDirectory.ToString(), "Products\\" + id.ToString()); if (Directory.Exists(pathString)) { Directory.Delete(pathString, true); } // Redirect return(RedirectToAction("Products")); }