public ActionResult AddProduct(ProductDataObject product)
 {
     using (var proxy = new ServiceProxy<IProductService>())
     {
         if (string.IsNullOrEmpty(product.ImageUrl))
         {
             var fileName = Guid.NewGuid().ToString() + ".png";
             System.IO.File.Copy(Server.MapPath("~/Images/Products/ProductImage.png"), Server.MapPath(string.Format("~/Images/Products/{0}", fileName)));
             product.ImageUrl = fileName;
         }
         var addedProducts = proxy.Channel.CreateProducts(new ProductDataObjectList { product });
         if (product.Category != null &&
             product.Category.ID != Guid.Empty.ToString())
             proxy.Channel.CategorizeProduct(new Guid(addedProducts[0].ID), new Guid(product.Category.ID));
         return RedirectToSuccess("添加商品信息成功!", "Products", "Admin");
     }
 }
 public ActionResult EditProduct(ProductDataObject product)
 {
     using (var proxy = new ServiceProxy<IProductService>())
     {
         proxy.Channel.UpdateProducts(new ProductDataObjectList { product });
         if (product.Category.ID != Guid.Empty.ToString())
             proxy.Channel.CategorizeProduct(new Guid(product.ID), new Guid(product.Category.ID));
         else
             proxy.Channel.UncategorizeProduct(new Guid(product.ID));
         return RedirectToSuccess("更新商品信息成功!", "Products", "Admin");
     }
 }