Exemplo n.º 1
0
        public ActionResult AddProduct()
        {
            var product = new Product
             {
                 Id = new Random().Next().ToString(),
                 InStock = true,
                 Manufacturer = "Apple",
                 Price = 50m,
                 Weight = 20,
                 Categories = new[] { "Computers", "Electronics" }
             };

             solr.Add(product);
             solr.Commit();

             return Json(new { product }, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
        public ActionResult Remove(Product product)
        {
            var ok = false;

            try
            {
                solr.Delete(product.Id);
                solr.Commit();
                ok = true;
            }
            catch (Exception exception)
            {

            }

             return Json(new { ok }, JsonRequestBehavior.AllowGet);
        }