예제 #1
0
        public IActionResult Update(GameUpdateModel gameUpdateModel)
        {
            try
            {
                var game = _gameDataAccess.UpdateAsync(gameUpdateModel.GameId.ToString(), new Games()
                {
                    GameName         = gameUpdateModel.GameName,
                    GameLogo         = gameUpdateModel.GameLogo,
                    DuelBanner       = gameUpdateModel.DuelBanner,
                    TournamentBanner = gameUpdateModel.TournamentBanner,
                    Pc          = gameUpdateModel.Pc,
                    Mobile      = gameUpdateModel.Mobile,
                    Playstation = gameUpdateModel.Playstation,
                    Xbox        = gameUpdateModel.Xbox
                }).Result;

                game = _gameDataAccess.GetByIdAsync(gameUpdateModel.GameId.ToString()).Result;

                if (game == null)
                {
                    return(BadRequest(new { message = "Game güncellenemedi!" }));
                }

                return(Ok(new { game }));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }