Esempio n. 1
0
        public ActionResult HeartRate(HeartRateViewModel vm)
        {
            if (vm == null)
            {
                vm = new HeartRateViewModel();
            }

            return(View(vm));
        }
Esempio n. 2
0
        public ActionResult AddHeartRate(HeartRateViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View("HeartRate", viewModel));
            }

            Metric heartRate = Metric.CreateMetric(User.Identity.GetUserId(), Infrastructure.enums.MetricType.RestingHeartRate, viewModel.GetRecordedDateTime(), viewModel.RestingHeartRate, true);

            _unitOfWork.Metrics.AddOrUpdateMetric(heartRate);

            _unitOfWork.Complete();

            if (viewModel.MoveOntoNextDay)
            {
                HeartRateViewModel vm = new HeartRateViewModel(viewModel.GetRecordedDateTime().AddDays(1));
                vm.MoveOntoNextDay = true;
                return(RedirectToAction("HeartRate", vm));
            }

            return(RedirectToAction("Index", "Home"));
        }
 private void InitialiseBandClient(IBandClient _bandClient)
 {
     Hr = new HeartRateViewModel(_bandClient);
 }