public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Request.Form["type"]; string account = context.Request.Form["account"]; string content = context.Request.Form["content"]; string name = context.Request.Form["name"]; if (type == "set") { AfficheModel affiche = new AfficheModel(account, content, name); if (Affiche.setAffiche(affiche)) { context.Response.Write("true"); } else { context.Response.Write("false"); } } else { string data = Affiche.getAffiche(); context.Response.Write(data); } }
public static bool setAffiche(AfficheModel affiche) { string command = $"insert into affiche (account,content,name) values ('{affiche.account}','{affiche.content}','{affiche.name}')"; return(SQL.Excute(command)); }