public string Save([FromBody] Models.TableConfiguration value) { try { if (value == null) { return("Empty"); } var filePath = System.Web.Hosting.HostingEnvironment.MapPath(path); var document = value.Id + ".json"; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } using (StreamWriter writer = new StreamWriter(filePath + document, false)) { writer.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(value)); } return(filePath + document); } catch (Exception ex) { return(ex.Message); } }
public string Delete([FromBody] Models.TableConfiguration value) { try { if (value == null) { return("Empty"); } var filePath = System.Web.Hosting.HostingEnvironment.MapPath(path); var document = value.Id + ".json"; File.Delete(filePath + document); return(filePath + document); } catch (Exception ex) { return(ex.Message); } }
public void ActivateDeActivateConfig([FromBody] Models.TableConfiguration value) { // TODO alleen active omzetten. niet hele config update if (value == null) { return; } var filePath = System.Web.Hosting.HostingEnvironment.MapPath(path); var document = value.Id + ".json"; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } using (StreamWriter writer = new StreamWriter(filePath + document, false)) { writer.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(value)); } }