コード例 #1
0
        public IEnumerable <Customer> Get()
        {
            var customers       = new List <Customer>();
            var customerRawData = _dataManagement.GetData(DataType.Customer);

            foreach (var customerItem in customerRawData ?? new List <Dictionary <string, string> >())
            {
                var customer = customerItem.ElementAt(0).Value;

                customers.Add(new Customer()
                {
                    Id        = int.Parse(customerItem.ElementAt(0).Key),
                    FirstName = customer.SplitGetStringByIndex(0),
                    LastName  = customer.SplitGetStringByIndex(1),
                    BirthDate = customer.SplitGetDateTimeByIndex(2)
                });
            }
            return(customers);
        }
コード例 #2
0
        public IEnumerable <Application> Get()
        {
            var applicationData    = new List <Application>();
            var applicationRawData = _dataManagement.GetData(DataType.Application);
            var menuRawData        = _dataManagement.GetData(DataType.Menu);

            foreach (var appItem in applicationRawData ?? new List <Dictionary <string, string> >())
            {
                var menus = new List <Menu>();
                foreach (var menuItem in menuRawData)
                {
                    menus.Add(new Menu()
                    {
                        Id = int.Parse(menuItem.ElementAt(0).Key), Name = menuItem.ElementAt(0).Value
                    });
                }
                applicationData.Add(new Application()
                {
                    Id = int.Parse(appItem.ElementAt(0).Key), Name = appItem.ElementAt(0).Value, Menus = menus
                });
            }

            return(applicationData);
        }