public static void UpdateGFT(int id, string name, string colour, int enterpriseid, string active) { if (GeofenceType.CheckExists(id) == true) { Connection conn = new Connection(); var sql = $"update geofencetype set name = '{name}', colour = '{colour}', enterpriseid = '{enterpriseid}', active = '{active}' where geofencetype.id = {id}"; var command = new SqlCommand(sql, conn.connection); var reader = command.ExecuteReader(); reader.Close(); } }
public static void DeleteGFT(int id) { if (GeofenceType.CheckExists(id) == true) { Connection conn = new Connection(); var sql = $"delete from geofencetype where geofencetype.id = {id}"; var command = new SqlCommand(sql, conn.connection); var reader = command.ExecuteReader(); reader.Close(); } }
//Funcion POST public static void PostGFT(int id, string name, string colour, int enterpriseid, string active) { if (GeofenceType.CheckExists(id) == false) { //Insert Connection conn = new Connection(); var sql = $"insert into geofencetype values ({id}, '{name}', null, '{colour}', {enterpriseid}, '{active}')"; var command = new SqlCommand(sql, conn.connection); var reader = command.ExecuteReader(); reader.Close(); } }