public IActionResult OnPostDel(DelParam item) { var result = new Dictionary <string, object>(); if (string.IsNullOrEmpty(item.name.ToLower().Replace(".xml", ""))) { result.Add("msg", "xml文件名填写不正确"); } else { System.IO.File.Delete(item.name); var map = BaseConfig.GetValue <SqlMap>("SqlMap", FastApiExtension.config.mapFile, false); if (!map.Path.Exists(a => string.Compare(a, item.name) == 0)) { var dic = new Dictionary <string, object>(); map.Path.Remove(item.name); dic.Add("SqlMap", map); var json = BaseJson.ModelToJson(dic); System.IO.File.WriteAllText(FastApiExtension.config.mapFile, json); FastMap.InstanceMap(); } result.Add("msg", "操作成功"); } return(new JsonResult(result)); }
public IActionResult OnPostDel(DelParam item) { var result = new Dictionary <string, object>(); if (string.IsNullOrEmpty(item.name.ToLower().Replace(".xml", ""))) { result.Add("msg", "xml文件名填写不正确"); } else { var xmlPath = string.Format("map/{0}", item.name); System.IO.File.Delete(xmlPath); var map = BaseConfig.GetValue <SqlMap>("SqlMap", "map.json"); if (map.Path.Exists(a => a.ToLower() == string.Format("map/{0}", item.name.ToLower()))) { var dic = new Dictionary <string, object>(); map.Path.Remove("map/" + item.name); dic.Add("SqlMap", map); var json = BaseJson.ModelToJson(dic); System.IO.File.WriteAllText("map.json", json); FastMap.InstanceMap(); } result.Add("msg", "操作成功"); } return(new JsonResult(result)); }