Example #1
0
 public static Link Create(Order order, string hostName)
 {
     var link = new Link
     {
         Rel = "item",
         HRef = string.Format("http://{0}/{1}/{2}", hostName, "orders", order.Id)
     };
     return link;
 }
        public OrderListModel(IEnumerable<Order> orders, string hostName)
        {
            _self = Link.Create(this, hostName);
            _items = orders.Select(task => OrderListItemModel.Create(task, hostName));

            if (!_items.Any())
            {
                //construct an empty result set
                _items = new List<OrderListItemModel>().Select(i => i);
            }
        }
Example #3
0
        public static Link Create(OrderListModel orderList, string hostName)
        {
            //we don't need to use taskList to build the self link
            var self = new Link
            {
                Rel = "self",
                HRef = string.Format("http://{0}/{1}", hostName, "orders")
            };

            return self;
        }
 public OrderListModel(IEnumerable<Order> orders, string hostName)
 {
     _self = Link.Create(this, hostName);
     _items = orders.Select(task => OrderListItemModel.Create(task, hostName));
 }