Example #1
0
    public async Task <IActionResult> Get()
    {
        try
        {
            var data       = DataManager.GetData();
            var saveResult = await _ratesService.SaveRatesAsync(data);

            if (saveResult)
            {
                // send data to all subscribed clients to the RatesMessageReceived event.
                new TimerManager(async() => await _hub.Clients.All.SendAsync("RatesMessageReceived", DataManager.GetData()));
            }

            return(Ok(new { Message = "Request Completed" }));
        }
        catch
        {
            return(StatusCode(500));
        }
    }