コード例 #1
0
        private async Task <ActionResult> ViewPatients(CancellationToken ct)
        {
            var cache = new ResponseCache <AgeBounds>(false, DefaultCacheTime.Long, _settings.ResponseCacheEnabled,
                                                      _settings.ResponseCacheDefaultShortTimeInMinutes, _settings.ResponseCacheDefaultLongTimeInMinutes);
            var ageBounds = cache.GetValue(Request);

            if (ageBounds == null)
            {
                ageBounds = await _glanceDa.GetAgeBoundsAsync(_credentials, ct);

                cache.SetValue(Request, ageBounds);
            }

            var model = new PatientsViewModel
            {
                AgeMax = Math.Ceiling(ageBounds.Max).ToString(System.Globalization.CultureInfo.InvariantCulture),
                AgeMin = Math.Floor(ageBounds.Min).ToString(System.Globalization.CultureInfo.InvariantCulture),
            };

            return(View(model));
        }
コード例 #2
0
        private async Task <ActionResult> ViewPatients(CancellationToken ct)
        {
            var cache = new ResponseCache <AgeBounds>(false, DefaultCacheTime.Long, _settings.ResponseCacheEnabled,
                                                      _settings.ResponseCacheDefaultShortTimeInMinutes, _settings.ResponseCacheDefaultLongTimeInMinutes);
            var ageBounds = cache.GetValue(Request);

            if (ageBounds == null)
            {
                ageBounds = await _glanceDa.GetAgeBoundsAsync(_credentials, ct);

                cache.SetValue(Request, ageBounds);
            }

            var model = new PatientsViewModel
            {
                AgeMax = ageBounds.Max,
                AgeMin = ageBounds.Min,
            };

            return(View(model));
        }