public ActionResult Create(Product product) { try { if (ModelState.IsValid) { int idP = services.InsertProduct(product); CreateProductViewModel model = new CreateProductViewModel() { idpro = idP }; IHubContext hubContext = GlobalHost.ConnectionManager.GetHubContext <ProductHob>(); if (product.CategoryId == 1) { hubContext.Clients.All.NewProductAddToMobile(product.Name); } else if (product.CategoryId == 3) { hubContext.Clients.All.NewProductAddToHome(product.Name); } else if (product.CategoryId == 4) { hubContext.Clients.All.NewProductAddToSport(product.Name); } else if (product.CategoryId == 2) { hubContext.Clients.All.NewProductAddToElec(product.Name); } return(View("AddImage", model)); } else { return(View()); } } catch { return(View()); } }