Пример #1
0
        public JsonResult Add(GameTableViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (!(Session["gamer"] is Gamer gamer))
                {
                    return(Json(Errors.GamerNotLoggedIn, JsonRequestBehavior.AllowGet));
                }

                var gameTable            = GetGameTable(model, gamer);
                var tableBoardGameIdList = model.TableBoardGameList.Select(x => x.BoardGameId).ToList();

                _gameTableService.CreateGameTable(gameTable, tableBoardGameIdList);

                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            var errors = Helpers.GetErrorMessages(ModelState.Values);

            return(Json(errors, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
 public GameTable Post(GameTable gameTable)
 {
     _logger.LogInformation("Creating gameTable");
     return(_gameTableService.CreateGameTable(gameTable));
 }