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 void Update(Product product)
 {
     _db.Products.UpdateById(product);
 }
 public Product Add(Product newProduct)
 {
     return _db.Products.Insert(newProduct);
 }