public SystemRequirements GetSystemReqById(int id) { SystemRequirements sysReq = new SystemRequirements(); using (_connection) { _connection.Open(); string selectString = "SELECT * FROM SystemRequirements WHERE SystemRequirementsId = @SystemRequirementsId"; command.CommandText = selectString; command.Parameters.Add("@SystemRequirementsId", id); SqlDataReader reader = command.ExecuteReader(); if (!reader.HasRows) return null; while (reader.Read()) { sysReq.Game = Convert.ToInt32(reader["Game"]); sysReq.OS = reader["OS"].ToString(); sysReq.Processor = reader["Processor"].ToString(); sysReq.Memory = reader["Memory"].ToString() + " GB Ram"; } reader.Close(); _connection.Close(); } return sysReq; }
public void UpdateGameById(SystemRequirements sysReq) { using (_connection) { _connection.Open(); string updateString = @"UPDATE SystemRequirements SET Processor = @Processor,Memory = @Memory, OS = @OS,Game = @Game WHERE SystemRequirementsId = @SystemRequirementsId"; command.CommandText = updateString; command.Parameters.Add("@SystemRequirementsId", sysReq.SystemRequirementsId); command.Parameters.Add("@Processor", sysReq.Processor); command.Parameters.Add("@OS", sysReq.OS); command.Parameters.Add("@Game", sysReq.Game); command.ExecuteNonQuery(); _connection.Close(); } }
public void InsertSysReqGame(SystemRequirements sysReq) { using (_connection) { _connection.Open(); string insertString = @"INSERT INTO SystemRequirements VALUES( @Processor,@Memory,@OS,@Game)"; command.CommandText = insertString; command.Parameters.Add("@Processor", sysReq.Processor); command.Parameters.Add("@Memory", sysReq.Memory); command.Parameters.Add("@OS", sysReq.OS); command.Parameters.Add("@Game", sysReq.Game); command.ExecuteNonQuery(); _connection.Close(); } }