internal ICollection <IPhone> LoadPhones(IClient c) { List <IPhone> lst = new List <IPhone>(); PhoneMapper pm = new PhoneMapper(mapperHelper.context); List <IDataParameter> parameters = new List <IDataParameter>(); parameters.Add(new SqlParameter("@nif", c.nif)); using (IDataReader rd = mapperHelper.ExecuteReader("select phoneid from phoneclient where nif=@nif", parameters)) { while (rd.Read()) { lst.Add(pm.Read(rd.IsDBNull(0) ? default : rd.GetInt32(0))); } } return(lst); }
public PhoneRepository(IContext ctx) { context = ctx; mapper = new PhoneMapper(ctx); }