Esempio n. 1
0
        public Product GetProduct(string name)
        {
            Product product = null;

            switch(name)
            {
                case "TestProduct":
                    product = new Product {ProductName = "TestProduct"};
                    break;
            }

            return product;
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 public bool CreateProduct(Product product)
 {
     throw new NotImplementedException();
 }