Esempio n. 1
0
        public ActionResult <IEnumerable <string> > CaseReports()
        {
            var caseReports = JsonConvert.DeserializeObject <CaseReport[]>(System.IO.File.ReadAllText("./TestData/CaseReports.json"));

            foreach (var caseReport in caseReports)
            {
                var report = new CaseReport(
                    Guid.NewGuid(),
                    caseReport.DataCollectorId,
                    caseReport.HealthRisk,
                    caseReport.Origin,
                    caseReport.Message,
                    caseReport.NumberOfMalesUnder5,
                    caseReport.NumberOfMalesAged5AndOlder,
                    caseReport.NumberOfFemalesUnder5,
                    caseReport.NumberOfFemalesAged5AndOlder,
                    caseReport.Longitude,
                    caseReport.Latitude,
                    DateTimeOffset.UtcNow);

                _caseReportsEventHandler.Handle(report);
            }

            return(caseReports.Select(x => x.Message).ToArray());
        }
        public void Process(CaseReportReceived @event)
        {
            var caseReport = new Read.CaseReports.CaseReport(@event.CaseReportId, @event.DataCollectorId,
                                                             @event.HealthRiskId, @event.Origin, @event.Message, @event.NumberOfMalesUnder5, @event.NumberOfMalesAged5AndOlder,
                                                             @event.NumberOfFemalesUnder5, @event.NumberOfFemalesAged5AndOlder, @event.Longitude, @event.Latitude,
                                                             @event.Timestamp);

            _caseReportsEventHandler.Handle(caseReport);
        }