private string CommandString(Tire tire) { string selectString = ""; if (tire.Width != 0) { selectString += $"(width = {tire.Width})"; } else { selectString += "(width = width)"; } if (tire.SideWall != 0) { selectString += $"AND (sidewall = {tire.SideWall})"; } else { selectString += "and (sidewall = sidewall)"; } if (tire.Diameter != null) { selectString += $"AND (diameter = '{tire.Diameter}')"; } else { selectString += "and (diameter = diameter)"; } if (tire.Season != null) { selectString += $"AND (season = '{tire.Season}')"; } else { selectString += "and (season = season)"; } if (tire.Brand != null) { selectString += $"AND (brand = '{tire.Brand}')"; } else { selectString += "and (brand = brand)"; } return(selectString); }
public IEnumerable <Tire> SelectByParam(Tire tire) { SelectRequest(CommandString(tire)); return(_tires); }