コード例 #1
0
 private void UpdateStatistics(BoardGameRecord boardGameRecord)
 {
     gameStatisticsService.SaveStatistics(boardGameRecord.Id, new GameStatistic()
     {
         Source = EntityViewSource.Application, ViewedDate = DateTime.Now
     });
 }
コード例 #2
0
        public async Task <IActionResult> Create(string param)
        {
            var model = new BoardGameCreateUpdateViewModel();

            if (await TryUpdateModelAsync(model))
            {
                var newRecord = new BoardGameRecord()
                {
                    MinPlayerAge     = model.MinPlayerAge,
                    MaxPlayersNumber = model.MaxPlayersNumber,
                    MinPlayersNumber = model.MinPlayersNumber,
                    Name             = model.Name
                };

                gameRepository.CreateOrUpdate(newRecord);
            }

            if (ModelState.ErrorCount > 0)
            {
                return(View());
            }

            return(RedirectToAction("Index"));
        }