Beispiel #1
0
        public ShoppingCartItemVM Map(ShoppingCartItem item)
        {
            var vm = new ShoppingCartItemVM
            {
                Id         = item.Id,
                UserId     = item.UserId,
                ProductId  = item.ProductId,
                DatePlaced = item.DatePlaced,
                Standard   = item.Standard,
                Quantity   = item.Quantity
            };

            return(vm);
        }
Beispiel #2
0
        public ShoppingCartItem Map(ShoppingCartItemVM vm)
        {
            ShoppingCartItem item = new ShoppingCartItem
            {
                ProductId  = vm.ProductId,
                Quantity   = vm.Quantity,
                Standard   = vm.Standard,
                DatePlaced = DateTime.Now,
            };

            if (vm.UserId != null)
            {
                item.UserId = (int)vm.UserId;
            }

            if (vm.Id != null)
            {
                item.Id = (int)vm.Id;
            }

            // Set the object refernece to a corresponding CP or SP
            // item.SetItem();
            return(item);
        }