public ActionResult Create(Product product) { var serviceChannelFactory = new ChannelFactory<IProductServiceChannel>("products"); try { using (var serviceChannel = serviceChannelFactory.CreateChannel()) { serviceChannel.AddProduct(product); return RedirectToAction("Index"); } } catch (Exception ex) { return View("Error", ex); } }
public void AddProduct(Product product) { context.Products.Add(product); context.SaveChanges(); }