public async Task <IActionResult> Post()
        {
            try
            {
                var result = await battleshipService.CreateBoard();

                if (result)
                {
                    return(StatusCode(201, response.Message));
                }
                else
                {
                    return(BadRequest(response.Message));
                }
            }
            catch (System.Exception ex)
            {
                logger.LogError(ex.Message, ex.StackTrace);
                return(StatusCode(500, "Internal server error"));
            }
        }
Example #2
0
        public string Post([FromBody] BoardName name)
        {
            const int boardSize = 10; // Fix board size

            return(_battleshipService.CreateBoard(name.Name, boardSize));
        }