Example #1
0
        public static Order From(OrderJson item)
        {
            var result = new Order()
            {
                OrderId      = item.OrderId,
                OrderDate    = item.OrderDate,
                Username     = item.Username,
                FirstName    = item.FirstName,
                LastName     = item.LastName,
                Address      = item.Address,
                City         = item.City,
                State        = item.State,
                PostalCode   = item.PostalCode,
                Country      = item.Country,
                Phone        = item.Phone,
                Email        = item.Email,
                Total        = item.Total,
                OrderDetails = new List <OrderDetail>()
            };

            foreach (var json in item.OrderDetails)
            {
                OrderDetail detail = OrderDetail.From(json);
                result.OrderDetails.Add(detail);
            }

            return(result);
        }
Example #2
0
        public static List <OrderJson> From(List <Order> items)
        {
            List <OrderJson> results = new List <OrderJson>();

            if (items == null)
            {
                return(results);
            }

            foreach (var a in items)
            {
                results.Add(OrderJson.From(a));
            }
            return(results);
        }
Example #3
0
        public static OrderJson From(Order item)
        {
            var result = new OrderJson()
            {
                OrderId      = item.OrderId,
                OrderDate    = item.OrderDate,
                Username     = item.Username,
                FirstName    = item.FirstName,
                LastName     = item.LastName,
                Address      = item.Address,
                City         = item.City,
                State        = item.State,
                PostalCode   = item.PostalCode,
                Country      = item.Country,
                Phone        = item.Phone,
                Email        = item.Email,
                Total        = item.Total,
                OrderDetails = OrderDetailJson.From(item.OrderDetails)
            };

            return(result);
        }