예제 #1
0
        public IActionResult CreateCategory([FromHeader] string AuthorizedCode, [FromBody] CategoryInputModel body)
        {
            if (AuthorizedCode == null || AuthorizedCode != _password)
            {
                return(StatusCode(403));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest("input model not valid"));
            }

            var categories = _newsService.CreateCategory(body);

            return(CreatedAtRoute("GetCategoryById", new { id = categories.Id }, null));
        }