public string Delete() { string result = ""; int id = Numerics.GetInt(Request["id"]); try { var repo = new ImportFileRepository(); var file = repo.GetByID(id); if (file != null) { string filePath = Server.MapPath("ImportFiles/") + file.URL; if (File.Exists(filePath)) File.Delete(filePath); repo.Delete(file); } result = JsonResult(true, Resources.Messages.Delete); } catch (Exception ex) { result = JsonResult(false, ex.Message); } return ""; }