public ActionResult Delete(int id) { var path = Path.Combine(Server.MapPath("~/Image"), id.ToString()); if (Directory.Exists(path)) { System.IO.DirectoryInfo di = new DirectoryInfo(path); foreach (FileInfo file in di.GetFiles()) { file.Delete(); } di.Delete(true); } var app = new ServiceReference.ContractClient(); app.DeleteProduct(id); return(RedirectToAction("GetAll")); }