Пример #1
0
 public IActionResult Index()
 {
     return(View(new HomeViewModel()
     {
         VisibleForms = _formsRepository.GetAllVisible(),
         LastChangedTimestamp = TimestampConvert.ConvertToTimestamp(_formsRepository.GetLastChanged())
     }));
 }
        public IActionResult Create(CreateScoreboardModel model)
        {
            if (ModelState.IsValid)
            {
                // Get the rounds
                List <ScoreboardRound> rounds = _formsRepository.GetAllVisible().Select(x => new ScoreboardRound()
                {
                    Id    = x.Id,
                    Title = x.Title,
                }).ToList();

                // Create the scoreboard
                _scoreboardRepository.Create(model.Title, rounds);

                return(RedirectToAction("Overview"));
            }
            else
            {
                // Invalid model state
                return(View(model));
            }
        }