示例#1
0
 public ActionResult Create(Product product)
 {
     using (var proxy = new ProductServiceClient())
     {
         proxy.Add(product);
         return(RedirectToAction("Index"));
     }
 }
示例#2
0
 public ActionResult Create(ProductServiceReference.Product pro)
 {
     ViewBag.CategoryId = new SelectList(cate.Get(), "Id", "Name");
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             prod.Add(pro);
             return(RedirectToAction("Index"));
         }
         return(View());
     }
     catch
     {
         return(View());
     }
 }