예제 #1
0
        public IEnumerable<Category> GetAllCategories()
        {
            FileLineReader lineReader = new FileLineReader();

            var categories = lineReader.ReadFileLines(this.categoriesFileName, true);

            return categories
                .Select(c => c.Split(','))
                .Select(c => new Category
                {
                    ID = int.Parse(c[0]),
                    Name = c[1],
                    Description = c[2]
                });
        }
예제 #2
0
        public IEnumerable<Order> GetAllOrders()
        {
            FileLineReader lineReader = new FileLineReader();

            var orders = lineReader.ReadFileLines(this.ordersFileName, true);

            return orders
                .Select(p => p.Split(','))
                .Select(p => new Order
                {
                    ID = int.Parse(p[0]),
                    ProductID = int.Parse(p[1]),
                    Quantity = int.Parse(p[2]),
                    Discount = decimal.Parse(p[3]),
                });
        }
예제 #3
0
        public IEnumerable<Product> GetAllProducts()
        {
            FileLineReader lineReader = new FileLineReader();

            var products = lineReader.ReadFileLines(this.productsFileName, true);

            return products
                .Select(p => p.Split(','))
                .Select(p => new Product
                {
                    ID = int.Parse(p[0]),
                    Name = p[1],
                    CategoryID = int.Parse(p[2]),
                    UnitPrice = decimal.Parse(p[3]),
                    UnitsInStock = int.Parse(p[4]),
                });
        }