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

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

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