Пример #1
0
        //[ProducesResponseType(StatusCodes.Status201Created, Type = typeof(BookDto))]
        public async Task <ActionResult> AddCategoriesToBook(Guid bookId, [FromBody] JArray categories, CancellationToken ct)
        {
            foreach (JObject categoryToAdd in categories)
            {
                var bookToReturn = await _bookCategoryService.CreateBookCategoryAsync(bookId, new Guid(categoryToAdd.GetValue("categoryId").ToString()), ct);

                if (bookToReturn == null)
                {
                    return(BadRequest());
                }
            }

            return(Ok());
        }
Пример #2
0
        public async Task <IActionResult> Create([FromBody] BookCategoryManageModel bookCategoryManageModel)
        {
            var response = await _bookCategoryService.CreateBookCategoryAsync(bookCategoryManageModel);

            return(new CustomActionResult(response));
        }