public ActionResult _AjaxRentBook(RentBookDTO dto)
        {
            var bookInfo = ApiRequestWithFormUrlEncodedContent.Get <EditBookDTO>($"{_inventoryApiBaseUrl}/api/Books/{dto.BookId}");

            var bookInventoryId = bookInfo.BookInventories.Where(p => p.Status == 1).FirstOrDefault()?.BookInventoryId;

            if (bookInventoryId.HasValue)
            {
                var commandId = ApiRequestWithStringContent.Post <Guid>($"{_rentalApiBaseUrl}/api/customers/{dto.CustomerId}/books", new
                {
                    BookId     = bookInventoryId,
                    BookName   = bookInfo.BookName,
                    ISBN       = bookInfo.ISBN,
                    CustomerId = dto.CustomerId,
                    Name       = new
                    {
                        FirstName  = "Lily",
                        MiddleName = string.Empty,
                        LastName   = "Jiang"
                    }
                });

                return(Json(new { result = true, commandId = commandId }));
            }
            else
            {
                return(Json(new { result = false, errorMessage = "Book has been rented, please try again." }));
            }
        }
        public ActionResult _AjaxBulkImported(BulkImportDTO dto)
        {
            List <Guid> newBookInventories = new List <Guid>();

            //hard code 10 repsitory id
            for (var i = 0; i < dto.Number; i++)
            {
                newBookInventories.Add(Guid.NewGuid());
            }

            var data = new NameValueCollection();

            data.Add("BookRepositoryIds", string.Join(",", newBookInventories.Select(p => p.ToString())));
            var commandKey = ApiRequestWithStringContent.Post <Guid>($"{_inventoryApiBaseUrl}/api/Books/{dto.BookId}/Inventories", new ImportBookInventoryDTO
            {
                BookInventoryIds = newBookInventories
            });

            return(Content(commandKey.ToString()));
        }