public Product GetProduct(string name) { Product product = null; switch(name) { case "TestProduct": product = new Product {ProductName = "TestProduct"}; break; } return product; }
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 CreateProduct(Product product) { var success = false; try { if (ProductDoesNotExisit(product.ProductName)) { using (var session = _store.OpenSession()) { session.Store(product); session.SaveChanges(); } success = true; } } catch (Exception ex) { throw ex; } return success; }
public bool CreateProduct(Product product) { throw new NotImplementedException(); }