public async Task <ActionResult <ApiEnsuresList> > GetLogs(string date)
        {
            // user's time
            DateTime d = DateTime.UtcNow;

            try
            {
                d = DateTime.ParseExact(date, EnsureConstants.DateTimeUrlFormat, CultureInfo.InvariantCulture);
            }
            catch { }
            var el = await _ensureService.GetLogsByDay(UserExtensions.GetId(User), d.Date);

            return(new ApiEnsuresList {
                CurrentReturnedDate = d, Logs = el
            });
        }
示例#2
0
        public async Task <IActionResult> Logs(string date)
        {
            // try parse, on failue just get today.
            DateTime d = date.FastParseFormattedDate() ?? DateTime.UtcNow;

            var currDayLogs = await _ensureService.GetLogsByDay(User.GetId(), d.Date);

            var u = await usersService.FindByIdReadonlyAsync(User.GetId());

            var vm = new HomeViewModel()
            {
                Logs        = currDayLogs,
                CurrentDate = d.Date,
                // current day progress - just count
                UserDailyProgress = currDayLogs.Count,
                UserDailyTarget   = u.DailyTarget,
            };

            return(View(vm));
        }