Esempio n. 1
0
        public async Task <IActionResult> AllDetails()
        {
            var sw            = new Stopwatch();
            var overviewmodel = RenderDayService.GetOverview();
            var sb            = new StringBuilder();

            sw.Start();
            var startTime = sw.ElapsedMilliseconds;

            foreach (var day in overviewmodel)
            {
                await day.Part1();

                var day1Time = sw.ElapsedMilliseconds - startTime;
                await day.Part2();

                var day2Time = sw.ElapsedMilliseconds - startTime - day1Time;
                sb.AppendLine($"{day.Name} part1 answer: {day.ResultPart1} ({day1Time} ms), part2 answer: {day.ResultPart2} ({day2Time} ms))");
                startTime = sw.ElapsedMilliseconds;
            }
            sw.Stop();
            sb.AppendLine($"Total executionTime {sw.ElapsedMilliseconds} ms");
            ViewBag.puzzleString = sb.ToString();

            return(View("Index", overviewmodel));
        }
Esempio n. 2
0
        //TODO make private leaderboard JSON with cookie WORK :)
        public async Task <ActionResult> GetLeaderBoard()
        {
            var overviewmodel = RenderDayService.GetOverview();
            var leaderboard   = await GetJSON();

            ViewBag.leaderboard = leaderboard;
            return(View("Index", overviewmodel));
        }
Esempio n. 3
0
        public async Task <IActionResult> Details(int id, int part)
        {
            var overviewmodel = RenderDayService.GetOverview();

            var AoCDay = overviewmodel.Where(c => c.ID == id).FirstOrDefault();

            if (AoCDay != null)
            {
                var partResult = string.Empty;
                AoCDay.PartsToRender = new List <EnumParts> {
                    (EnumParts)part
                };
                await AoCDay.RenderParts();

                partResult = AoCDay.GetResult((EnumParts)part);
                if (!string.IsNullOrWhiteSpace(partResult))
                {
                    ViewBag.puzzleString = $"{partResult}";
                }
            }

            return(View("Index", overviewmodel));
        }
Esempio n. 4
0
 public ActionResult Index()
 {
     return(View("Index", RenderDayService.GetOverview()));
 }