public List <IDomainObject> VratiListu(SqlDataReader reader) { try { List <IDomainObject> types = new List <IDomainObject>(); while (reader.Read()) { TipLajsne type = new TipLajsne { Id = (long)reader[0], NazivTipa = reader[1].ToString() }; string[] dimn = reader[2].ToString().Split(";"); type.Dimenzije = new Dimenzije() { Duzina = Convert.ToInt32(dimn[0]), Visina = Convert.ToInt32(dimn[1]) }; types.Add(type); } return(types); } catch (Exception) { return(null); } }
public IDomainObject VratiObjekat(SqlDataReader reader) { try { TipLajsne type = new TipLajsne(); while (reader.Read()) { type.Id = (long)reader[0]; type.NazivTipa = reader[1].ToString(); string[] dimn = reader[2].ToString().Split(";"); type.Dimenzije = new Dimenzije() { Duzina = Convert.ToInt32(dimn[0]), Visina = Convert.ToInt32(dimn[1]) }; break; } return(type); } catch (Exception) { return(null); } }