Example #1
0
        public OrderDto GenOrderI()
        {
            var imapper = AutoMapperConfig.GetMapper();

            var customer = new CustomerCx {
                Name = "George Costanza"
            };

            var order = new Order
            {
                Customera = customer
            };

            var bosco = new Product
            {
                Name  = "Bosco",
                Price = 4.99m
            };

            order.AddOrderLineItem(bosco, 15);

            var result = imapper.Map <OrderDto>(order);

            return(result);
        }
Example #2
0
        public OrderDto GenOrderII()
        {
            var customer = new CustomerCx {
                Name = "Bob"
            };

            var order = new Order {
                Customera = customer, Total = 15.8m
            };

            var imapper = AutoMapperConfig.GetMapper();

            var orderDto = imapper.Map <OrderDto>(order);

            orderDto.CustomeraName = "Joe";

            imapper.Map(orderDto, order);

            return(orderDto);
        }
Example #3
0
        public Order GenOrder()
        {
            var customer = new CustomerCx {
                Name = "George Costanza"
            };

            var order = new Order
            {
                Customera = customer
            };

            var bosco = new Product
            {
                Name  = "Bosco",
                Price = 4.99m
            };

            order.AddOrderLineItem(bosco, 15);

            return(order);
        }