usingSystem;usingSystem.Collections.Generic;usingSystem.Data.SqlClient;usingAirPollutionWebApi.Models;namespaceAirPollutionWebApi.Singletons{publicstaticclassSqlOperator{conststringConnectionString="Server=tcp:forschool.database.windows.net,1433;"+"Initial Catalog=schooldb;"+"Persist Security Info=False;"+"User ID=***REMOVED***;"+"Password=***REMOVED***;"+"MultipleActiveResultSets=False;"+"Encrypt=True;"+"TrustServerCertificate=False;"+"Connection Timeout=30;";publicstaticList<Reading>GetReadings(stringcommand){varreadings=newList<Reading>();using(SqlConnectiondatabaseConnection=newSqlConnection(ConnectionString)){databaseConnection.Open();SqlCommandselectCommand=newSqlCommand(command,databaseConnection);varreader=selectCommand.ExecuteReader();while(reader.Read()){readings.Add(newReading{Id=reader.GetInt32(0),TimeStamp=reader.GetInt32(1),Co=reader.GetInt32(2),No=reader.GetInt32(3),So=reader.GetInt32(4)});}}returnreadings;}publicstaticvoidPutReading(intid,Readingreading){using(SqlConnectiondbCon=newSqlConnection(ConnectionString)){dbCon.Open();stringquery=$"UPDATE Readings SET TimeStamp='{reading.TimeStamp}',"+$"Co='{reading.Co}', No='{reading.No}', So='{reading.So}' WHERE Id={id};";varcmd=newSqlCommand(query,dbCon);cmd.ExecuteNonQuery();dbCon.Close();}}publicstaticvoidPostReading(Readingreading){using(SqlConnectiondbCon=newSqlConnection(ConnectionString)){dbCon.Open();stringquery=$"INSERT INTO Readings (TimeStamp,Co,No,So)"+$"VALUES('{reading.TimeStamp}',{reading.Co},{reading.No},{reading.So});";varcmd=newSqlCommand(query,dbCon);cmd.ExecuteNonQuery();dbCon.Close();}}publicstaticvoidDeleteReading(intid){using(SqlConnectiondbCon=newSqlConnection(ConnectionString)){dbCon.Open();stringquery=$"DELETE FROM Readings WHERE Id={id};";varcmd=newSqlCommand(query,dbCon);cmd.ExecuteNonQuery();dbCon.Close();}}}}