Exemple #1
0
        public int AddGame(InnerGameModel gamedata)
        {
            var gameDto        = new GameDTO();
            var modelViewToDto = new ModelViewToDTO();
            var dtoToEntities  = new DTOToEntities();

            modelViewToDto.GetGameDto(gamedata, gameDto);
            var game = dtoToEntities.GetGame(gameDto);
            int id   = _gameRepository.CreateAndKnowId(game);

            return(id);
        }
Exemple #2
0
 public int AddGame(InnerGameViewModel gamedata)
 {
     try
     {
         var gameDto = new GameDTO();
         _modelViewToDto.GetGameDto(gamedata, gameDto);
         var game = _dtoToEntities.GetGame(gameDto);
         _gameRepository.Create(game);
         var historyGame = new History();
         historyGame.LogDateTime = DateTime.Now;
         historyGame.GameId      = game.Id;
         _historyRepository.Create(historyGame);
         return(game.Id);
     }
     catch (Exception e)
     {
         LogWriter.WriteLog(e.Message, "CreateGameService");
         return(0);
     }
 }