public static List <PriceHistory> GetAllHistories() { using (FreeMarketEntities db = new FreeMarketEntities()) { List <PriceHistory> result = db.GetPriceHistories() .Select(c => new PriceHistory { Date = c.Date, Description = c.Description, NewPrice = c.NewPrice, PriceID = c.PriceID, OldPrice = c.OldPrice, SupplierName = c.SupplierName, SupplierNumber = c.SupplierNumber, ProductNumber = c.ProductNumber, Type = c.Type }).ToList(); if (result == null) { result = new List <PriceHistory>(); } return(result); } }