예제 #1
0
        public async Task <IActionResult> OnGetAsync()
        {
            ApplicationUser user = await _applicationUserService.GetUserByName(User.Identity.Name);

            var logs = await _weigtLogManageService.GetAllWeightLogs(user);

            MeasureType = user.MeasureType;

            if (MeasureType == MeasureType.lbs)
            {
                logs = logs.Select(log => log = WeightConverter.ConvertToLbs(log));
            }

            WeightLogs = _mapper.Map <IEnumerable <WeightLogTableViewModel> >(logs);

            return(Page());
        }
예제 #2
0
        public async Task <IActionResult> OnGetAsync()
        {
            IEnumerable <FC_MVVC.Data.Models.WeightLog> weightLogs = await _weigtLogService.GetAllWeightLogs(await _applicationUserService.GetUserByName(User.Identity.Name));

            Title = "Data since starting weight";
            ApplicationUser user = await _applicationUserService.GetUserByName(User.Identity.Name);

            MeasureType = user.MeasureType;
            if (MeasureType == MeasureType.lbs)
            {
                weightLogs = weightLogs.Select(log => WeightConverter.ConvertToLbs(log));
            }

            IList <WeightLogViewModel> chartData = _mapper.Map <IEnumerable <WeightLogViewModel> >(weightLogs).ToList();

            WeightLogs = chartData.OrderBy(log => log.LogDate);

            return(Page());
        }