Beispiel #1
0
        protected async Task HandleSubmitAsync()
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();

            var isValid = EditContext.Validate();

            try
            {
                LoadFailed = false;

                if (isValid)
                {
                    IsCalculating = true;

                    FormModel.FormOutputs = await AnthroService.GetScores(FormModel.FormInputs).ConfigureAwait(true);

                    IsCalculating = false;
                }
                else
                {
                    LoadFailed = true;
                }
            }
            catch (ApplicationException ex)
            {
                LoadFailed = true;
                Error.ProcessError(ex);
                ErrorMessage = ex.Message;
                Logger.LogWarning(ex.Message);
            }

            watch.Stop();
            ExecutionTime = "- Submit 1 (New) - " + watch.ElapsedMilliseconds + "ms";
        }
Beispiel #2
0
        public async Task <double> CalculateBMI()
        {
            Tuple <double, double> wfaTuple = await AnthroStatsService.GetWFA(Weight, "365", Sex).ConfigureAwait(false);

            WfaZscore     = wfaTuple.Item1;
            WfaPercentile = wfaTuple.Item2;

            BMI = await AnthroService.GetBMI(Weight, Height).ConfigureAwait(false);

            BMI = Math.Round(BMI, 1);

            return(BMI);
        }