public ProductModel(Product product, string hostName)
 {
     ProductName = product.ProductName;
     ProductDescription = product.ProductDescription;
     ProductPrice = product.ProductPrice;
     Id = product.Id;
     Self = new Link {Rel = "item", HRef = string.Format("http://{0}/{1}/{2}", hostName, "products", product.Id)};
 }
 public static Link Create(Product product, string hostName)
 {
     var link = new Link
     {
         Rel = "item",
         HRef = string.Format("http://{0}/{1}/{2}", hostName, "products", product.Id)
     };
     return link;
 }
        public static Link Create(ProductListModel 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, "products")
            };

            return self;
        }
 public ProductListModel(IEnumerable<Product> products, string hostName)
 {
     _self = Link.Create(this, hostName);
     _items = products.Select(product => new ProductModel(product, hostName));
 }