public ActionResult Index(string productName) { RavenDemoModel model = null; try { model = new RavenDemoModel(); ViewBag.Message = "Let's Get Social."; if (!string.IsNullOrEmpty(productName)) { var product = new Product { Id = productName, ProductName = productName }; _products.CreateProduct(product); } model.Products = _products.GetProducts(); } catch (Exception ex) { Logger.Error(ex); } return(View(model)); }
public bool AddProduct(Product product) { if (product == null) { throw new ArgumentException(); } return(_handler.CreateProduct(product)); }