Exemplo n.º 1
0
        private void HandleMessage(dynamic content)
        {
            try
            {
                dynamic  jsonData = JObject.Parse(content);
                DateTime dt       = Convert.ToDateTime(jsonData.date);
                string   pureData = jsonData.rst.ToString();
                pureData = pureData.Replace(" ", String.Empty);
                Cumulative c = new Cumulative()
                {
                    Type        = jsonData.type,
                    DynamicData = pureData,
                    GatewayId   = jsonData.gateway_id,
                    Date        = dt
                };

                _cumulativeRepository.Create(c);

                _logger.LogInformation($"consumer received {content}");
            }
            catch (Exception e)
            {
                _logger.LogInformation($"Error {e.Message}");
            }
        }
 public IActionResult SendData(Cumulative data)
 {
     _cumulativeRepository.Create(data);
     return(Ok("Başarılı"));
 }