Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
 public void AddProduct(Product product)
 {
     // Call the broadcastMessage method to update clients.
     Clients.Others.addProduct(Newtonsoft.Json.JsonConvert.SerializeObject(product));
 }
Esempio n. 3
0
 public virtual void AddProduct(Product product)
 {
     product.Categories.Add(this);
     Products.Add(product);
 }
Esempio n. 4
0
 public virtual void AddProduct(Product product)
 {
     product.Stores.Add(this);
     Products.Add(product);
 }
Esempio n. 5
0
        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;
            }
        }