public JsonResult SaveMacroTemplate(int id, string content)
{
using (var db = DatabaseContext.Database)
{
var view = db.FirstOrDefault<string>("SELECT macroPython FROM cmsMacro WHERE id = @0", id);
if (System.IO.File.Exists(Server.MapPath(view)))
{
System.IO.File.WriteAllText(Server.MapPath(view), content, Encoding.UTF8);
return Json(new { success = true });
}
else
{
return Json(new { success = false, message = "Template does not exist" });
}
}
}