public PricePoolS[] GetPricePools() { using (MasterDBDataContext db = new MasterDBDataContext()) { var pricePools = db.PricePool.ToArray(); if (pricePools != null) { PricePoolS[] result = new PricePoolS[pricePools.Length]; for (int i = 0; i < pricePools.Length; i++) { result[i] = new PricePoolS() { id = pricePools[i].idPricePool, eventId = (int) pricePools[i].idEvent, priceId = (int) pricePools[i].idPrice, placeRangeMax = pricePools[i].placeRangeMax, placeRangeMin = pricePools[i].placeRangeMin, placePercent = (float) pricePools[i].placePurcent }; } return result; } return null; } }
public PricePoolS[] GetPricePool(int eventId) { using (MasterDBDataContext db = new MasterDBDataContext()) { var pricePools = db.PricePool.Where(pp => pp.idEvent == eventId); if (pricePools != null) { PricePoolS[] result = new PricePoolS[pricePools.ToArray().Length]; PricePool[] temp = pricePools.ToArray(); for (int i = 0; i < temp.Length; i++) { result[i] = new PricePoolS() { id = temp[i].idPricePool, eventId = (int)temp[i].idEvent, priceId = (int)temp[i].idPrice, placeRangeMin = temp[i].placeRangeMin, placeRangeMax = temp[i].placeRangeMax, placePercent = (float)temp[i].placePurcent }; } return result; } else return null; } }