private static string deleteGenerador(DBStorage db, string message) { GeneradorQuery query; try { query = (GeneradorQuery)JsonConvert.DeserializeObject(message, typeof(GeneradorQuery)); } catch (Exception) { return("ERR"); } if (query == null || query.id <= 0 || query.redElectrica <= 0) { return("ERR"); } return(db.deleteGeneradorRedElectrica(query.redElectrica, query.id) ? "OK" : "ERR"); }