public IEnumerable <ProbaParticipant> FindProbaParticipantDupaProba(int p) { log.Info("Se incepe conectarea la bd si selectarea probe participantilor " + p); var con = DBUtils.getConnection(); IList <ProbaParticipant> probeparticipanti = new List <ProbaParticipant>(); using (var comm = con.CreateCommand()) { comm.CommandText = "select * from ProbeParticipanti where idProba=@idProba"; var paramNume = comm.CreateParameter(); paramNume.ParameterName = "@idProba"; paramNume.Value = p; comm.Parameters.Add(paramNume); using (var dataR = comm.ExecuteReader()) { while (dataR.Read()) { int id = dataR.GetInt32(1); ProbaParticipant pp = new ProbaParticipant(p, id); probeparticipanti.Add(pp); } } } return(probeparticipanti); }
public ProbaParticipant Save(ProbaParticipant elem) { log.Info("Se incearca adaugarea"); var con = DBUtils.getConnection(); using (var comm = con.CreateCommand()) { comm.CommandText = "insert into ProbeParticipanti (idProba,idParticipant) values (@idProba, @idParticipant)"; var paramNume = comm.CreateParameter(); paramNume.ParameterName = "@idProba"; paramNume.Value = elem.IdProba; comm.Parameters.Add(paramNume); var paramVarsta = comm.CreateParameter(); paramVarsta.ParameterName = "@idParticipant"; paramVarsta.Value = elem.IdParticipant; comm.Parameters.Add(paramVarsta); var result = comm.ExecuteNonQuery(); log.Info("S-a adaugat " + elem.ToString()); return(elem); } }
public ProbaParticipant Delete(ProbaParticipant elem) { throw new NotImplementedException(); }