public JsonResult Post(string table, [FromBody] JObject parameters) { try { MarketContext MC = new MarketContext(); MC.CreateConnection(); if (MC.Connected()) { return(Json(MC.Insert(table, parameters))); } else { throw new Exception("Connection failed"); } } catch (Exception ex) { return(Json("Error: " + ex.Message)); } }
public JsonResult Get(string table, string filter) { try { MarketContext MC = new MarketContext(); MC.CreateConnection(); if (MC.Connected()) { return(Json(MC.Select(table, filter))); } else { throw new Exception("Connection failed"); } } catch (Exception ex) { return(Json("Error: " + ex.Message)); } }
public JsonResult Delete(string table, int id) { try { MarketContext MC = new MarketContext(); MC.CreateConnection(); if (MC.Connected()) { return(Json(MC.Delete(table, id))); } else { throw new Exception("Connection failed"); } } catch (Exception ex) { return(Json("Error: " + ex.Message)); } }
public JsonResult Delete(string table, string filter) { string FullTable = "public." + '"' + table + '"'; try { MarketContext MC = new MarketContext(); MC.CreateConnection(); if (MC.Connected()) { return(Json(MC.Delete(FullTable, filter))); } else { throw new Exception("Connection failed"); } } catch (Exception ex) { return(Json("Error: " + ex.Message)); } }