public List <BodyStyle> GetAllBodyStyles() { List <BodyStyle> bodyList = new List <BodyStyle>(); using (var cn = new SqlConnection(Settings.GetConnectionString())) { SqlCommand cmd = new SqlCommand("GetAllBodyStyles", cn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { BodyStyle body = new BodyStyle(); body.BodyStyleId = (int)dr["BodyStyleId"]; body.BodyStyleName = dr["BodyStyleName"].ToString(); bodyList.Add(body); } } return(bodyList); } }
public List <BodyStyle> GetAllBodyStyles() { List <BodyStyle> bodyStyles = new List <BodyStyle>(); using (var cn = new SqlConnection("Server=localhost;Database=GuildCars;User Id=sa;Password=sqlserver;")) { SqlCommand cmd = new SqlCommand("DisplayBodyStyles", cn); cmd.CommandType = CommandType.StoredProcedure; cn.Open(); using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { BodyStyle currentRow = new BodyStyle(); currentRow.BodyStyleId = (int)dr["BodyStyleId"]; currentRow.BodyStyleName = dr["BodyStyleName"].ToString(); bodyStyles.Add(currentRow); } } } return(bodyStyles); }
public void UpdateBodyStyle(BodyStyle bodyStyle) { throw new NotImplementedException(); }
public void InsertBodyStyle(BodyStyle bodyStyle) { throw new NotImplementedException(); }