コード例 #1
0
        public async Task <IActionResult> CreateSection([FromBody] string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(BadRequest());
            }
            var result = await _forumSectionService.CreateAsync(name);

            if (result == null)
            {
                return(StatusCode((int)HttpStatusCode.Conflict)); //new HttpStatusCodeResult(422);
            }
            return(Ok(result));
        }