public Product AddProduct(Product product)
        {
            try {
                db.ProductRepository.Insert(product);
                db.Save();

                // HACK
                IHubContext _context =  GlobalHost.ConnectionManager.GetHubContext<StoreHub>();
                _context.Clients.All.AddProduct(Newtonsoft.Json.JsonConvert.SerializeObject(product));

                return product;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
 public void AddProduct(Product product)
 {
     // Call the broadcastMessage method to update clients.
     Clients.Others.addProduct(Newtonsoft.Json.JsonConvert.SerializeObject(product));
 }
 public virtual void AddProduct(Product product)
 {
     product.Categories.Add(this);
     Products.Add(product);
 }
Exemple #4
0
 public virtual void AddProduct(Product product)
 {
     product.Stores.Add(this);
     Products.Add(product);
 }
        public Boolean UpdateProduct(string ProductId, Product product)
        {
            try
            {
                db.ProductRepository.Update(product);
                db.Save();

                // HACK
                IHubContext _context = GlobalHost.ConnectionManager.GetHubContext<StoreHub>();
                _context.Clients.All.UpdateProduct(Newtonsoft.Json.JsonConvert.SerializeObject(product));

                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }