コード例 #1
0
        public async Task <IActionResult> CreateWishItem([FromBody] WishListForCreateDto input)
        {
            var userId = GetUserId();

            if (userId == "error")
            {
                return(Unauthorized(new { message = "unauthorized" }));
            }
            var wishItem = new WishList()
            {
                ApplicationUserId = userId,
                BookID            = input.BookId
            };
            var result = await _wishListService.CreateWishItem(wishItem);

            if (result)
            {
                return(Ok(new { message = "Đã thêm vào danh sách yêu thích của bạn" }));
            }
            return(BadRequest(new { message = "bad request" }));
        }