예제 #1
0
        public async Task <ActionResult <ArticleCategoryDTO> > AddArticleCategory(UpdateArticleCategoryRequest createdArticleCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var articleCategory = await articleCategoryService.CreateArticleCategoryAsync(createdArticleCategory);

            return(CreatedAtAction("GetArticleCategory", new { articleCategoryId = articleCategory.Id }, articleCategory));
        }
예제 #2
0
        public async Task <IActionResult> UpdateArticleCategory(int articleCategoryId, UpdateArticleCategoryRequest updatedArticleCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var articleCategory = await articleCategoryService.UpdateArticleCategoryAsync(articleCategoryId, updatedArticleCategory);

            if (articleCategory == null)
            {
                return(NotFound());
            }

            return(NoContent());
        }