示例#1
0
        /// <summary>
        /// update a play area
        /// </summary>
        /// <param name="tournamentId"></param>
        /// <param name="playAreaId"></param>
        /// <param name="playArea"></param>
        /// <returns></returns>
        public IActionResult UpdatePlayArea(int tournamentId, int playAreaId, Models.PlayArea playArea)
        {
            DbModels.Tournament tournament = this._repoWrapper.Tournament.GetById(tournamentId);
            if (tournament == null)
            {
                return(new NotFoundResult());
            }

            // Only update while tournament not started
            if (tournament.State != DbModels.TournamentState.Created)
            {
                return(new BadRequestObjectResult("Tournament allready started of finished"));
            }

            DbModels.PlayArea dbPlayArea = this._repoWrapper.PlayArea.GetById(playAreaId);
            if (dbPlayArea == null)
            {
                return(new NotFoundResult());
            }

            dbPlayArea.Name        = playArea.Name;
            dbPlayArea.Description = playArea.Description;

            this._repoWrapper.PlayArea.SaveChanges();

            return(new OkResult());
        }
示例#2
0
 public IActionResult UpdatePlayArea(int tournamentId, int playAreaId, Models.PlayArea playArea)
 {
     return(this._service.UpdatePlayArea(tournamentId, playAreaId, playArea));
 }