Beispiel #1
0
        public async Task <IActionResult> Create(CreateRequest request)
        {
            try
            {
                var league = await leagueService.Create(request.Name, request.GameID, request.AdminID);

                return(CodeResult(HttpStatusCode.Created, league));
            }
            catch (Exception exception)
            {
                return(GetExceptionResult(exception, request));
            }
        }
Beispiel #2
0
        public async Task <IActionResult> Create(CreateRequest request)
        {
            try
            {
                var league = await leagueService.Create(request.Name, request.GameID, request.AdminID);

                logger.LogInformation($"League {league.ID} created.");

                return(RedirectToAction("Home", new { leagueID = league.ID }));
            }
            catch (Exception exception)
            {
                return(GetExceptionResult(exception, request));
            }
        }
Beispiel #3
0
        public async Task Create_Valid_CreatedResult()
        {
            var gameID  = DbContextUtility.AddNew <Game>(dbContext).ID;
            var request = new CreateRequest
            {
                Name   = LeagueName,
                GameID = gameID
            };

            leagueService.Create(LeagueName, gameID, "").Returns(new League
            {
                Name   = LeagueName,
                GameID = gameID
            });

            var result = await testObj.Create(request);

            ControllerUtility.AssertStatusCode(result, HttpStatusCode.Created);
        }