public HttpResponseMessage PostProduct(Product item)
 {
     item = mgr.CreateProduct(item);
     var response = Request.CreateResponse<Product>(HttpStatusCode.Created, item);
     string uri = Url.Link("DefaultApi", new { id = item.ProductId});
     response.Headers.Location = new Uri(uri);
     return response;
 }
 public void UpdateProduct( Product product)
 {
     if (null ==  product)
     {
     throw new ArgumentNullException("Product");
     }
     using (NgTsTransactionScope scope = new NgTsTransactionScope())
     {
     _AddUpdate( product);
     scope.Complete();
     }
 }
 private void _AddUpdate(Product product)
 {
     if (0 == product.ProductId)
     {
     _DefaultsForCreate(product);
     //ValidationUtility.Validate(product);
     RepProduct.Add(product);
     }
     else
     {
     Product oldProduct;
     oldProduct = _GetProduct(product.ProductId);
     _DefaultsForUpdate(product);
     _OverrideEdit(oldProduct, product);
     //ValidationUtility.Validate(product);
     RepProduct.Save(product);
     }
 }
 private void _DefaultsForCreate(Product product)
 {
     //product.CreatedDate = DateTime.UtcNow;
     //product.UpdatedDate = DateTime.UtcNow;
     //product.CreatedById = this.Session.MemberEzkey;
     //product.UpdatedById = this.Session.MemberEzkey;
 }
 private void _Validate(Product product)
 {
 }
 private void _OverrideEdit(Product oldValue, Product newValue)
 {
     //newValue.UpdatedDate = oldValue.UpdatedDate;
     //newValue.UpdatedById = oldValueMemberEzkey;
 }
 public void PutProduct(long id, Product item)
 {
     item.ProductId = id;
     mgr.UpdateProduct(item);
 }