static void GenereteObservations(IEnumerable <ResidentDto> residents) { foreach (var resident in residents) { for (int i = 0; i < 30; i++) { var bloodPressure = CreateObservation(ObservationType.BloodPressure, resident, i); var heartRate = CreateObservation(ObservationType.HeartRate, resident, i); Console.WriteLine($"Resident #{resident.ResidentId} blood pressure is {bloodPressure.SystolicValue} / {bloodPressure.DiastolicValue} {bloodPressure.Unit}"); Console.WriteLine($"Resident #{resident.ResidentId} heart rate is {heartRate.Value} {bloodPressure.Unit}"); ObservationService.AddObservation(bloodPressure); ObservationService.AddObservation(heartRate); } for (int i = 0; i < 7; i++) { var temperature = CreateObservation(ObservationType.Temperature, resident, i); Console.WriteLine($"Resident #{resident.ResidentId} temperature is {temperature.Value} {temperature.Unit}"); ObservationService.AddObservation(temperature); } } }
public async Task <RequestResult> Add([FromBody] AddObservationViewModel model) { try { var response = await _observationService.AddObservation(new Observation { SequenceId = model.Sequence, Color = model.Observation.Color, Numbers = model.Observation.Numbers }); return(new SuccessResult { Status = "ok", Response = new { response.Start, response.Missing } }); } catch (Exception e) { return(new ErrorResult { Status = "error", Msg = e.Message }); } }