private GetExerciseIntensityMsg CalculateIntensities(List <GetExerciseHeartRateMsg> list, int age, int resting) { string time; double avgBmp; double intensity; GetExerciseIntensityMsg message = new GetExerciseIntensityMsg(); message.Dates = new List <string>(); message.Percentages = new List <double>(); int i = 0; List <PersonalIntensities> personalIntensities = GetPersonalIntensities(age, resting); foreach (GetExerciseHeartRateMsg msg in list) { time = msg.startTime; avgBmp = msg.bpmAvg; intensity = GetClosestIntensity(avgBmp, personalIntensities); message.Dates.Add(time); message.Percentages.Add(intensity); ++i; } return(message); }
public async Task <IActionResult> GetIntensities([FromBody] UsernameData data) { GetExerciseIntensityMsg intensity = null; try { intensity = await _BiometricService.GetIntensities(data); } catch (Exception) { return(BadRequest()); } return(Ok(intensity)); }