public IActionResult OnGet()
        {
            var time      = DateTime.Now;
            var isMorning = time.Hour < 12;

            Workout = new WorkoutCreateViewModel
            {
                Date      = time.Date,
                Name      = ValuesHelper.ComposeWorkoutName(time, isMorning),
                Place     = _configuration["DefaultSwimPlace"],
                IsMorning = isMorning
            };
            return(Page());
        }
Beispiel #2
0
        public IActionResult GetWorkoutName(DateTime selectedDate, bool isMorning)
        {
            string result;

            if (selectedDate > DateTime.MinValue)
            {
                //if (!string.IsNullOrEmpty(value) && DateTime.TryParse(value, out DateTime date))
                //{
                //    var dateAndTime = new DateTime(date.Year, date.Month, date.Day, DateTime.Now.Hour, 0, 0);
                result = ValuesHelper.ComposeWorkoutName(selectedDate, isMorning);
            }
            else
            {
                result = string.Empty;
            }

            return(new JsonResult(result));
        }