internal static DbStore ToDbStore(Store store)
        {
            var data = store.Data;
            var operatingLocations = data.OperatingLocationIds.ConvertAll(olid =>
                                                                          OperatingLocationDbSetInterfacer.ToDbOperatingLocation(
                                                                              StoreManagerApplication.Get <OperatingLocation>(olid)
                                                                              )
                                                                          );
            var inventory = data.Inventory.Select(
                kv => ToDbStoreInventory(kv)
                ).ToList();

            return(new DbStore
            {
                StoreId = store.Id,
                Name = data.Name,
                OperatingLocations = operatingLocations,
                StoreInventories = inventory
            });
        }
예제 #2
0
        internal static DbOrder ToDbOrder(Order order)
        {
            var data = order.Data;
            // Get the customer
            var customer = CustomerDbSetInterfacer.ToDbCustomer(
                StoreManagerApplication.Get <Customer>(data.CustomerId)
                );
            // Get the Operating Location
            var operatingLocations = OperatingLocationDbSetInterfacer.ToDbOperatingLocation(
                StoreManagerApplication.Get <OperatingLocation>(data.OperatingLocationId)
                );
            // Get the Products Requested
            var productsRequested = data.ProductsRequested.Select(
                pr => ToDbOrderProduct(pr)
                ).ToList();

            return(new DbOrder
            {
                OrderId = order.Id,
                Customer = customer,
                OperatingLocation = null,
                OrderProducts = productsRequested
            });
        }