using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; using Nop.Plugin.Misc.SignalRApi.Hubs; namespace Nop.Plugin.Misc.SignalRApi.Controllers { [Route("api/[controller]")] [ApiController] public class ProductOfferController : ControllerBase { private IHubContext mainHub; public ProductOfferController(IHubContext _mainHub) { mainHub = _mainHub; } [HttpPost] [Route("productoffers")] public string Get() { List offers = new List(); offers.Add("20% Off on IPhone 12"); offers.Add("15% Off on HP Pavillion"); offers.Add("25% Off on Samsung Smart TV"); //mainHub.Clients.All.SendOffersToUser(offers); return "Offers sent successfully to all users!"; } } }