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 _AjaxGetAvailableBooks() { var data = ApiRequestWithFormUrlEncodedContent.Get <List <AvailableBookModel> >($"{_inventoryApiBaseUrl}/api/available_books"); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(Guid id) { var data = ApiRequestWithFormUrlEncodedContent.Get <EditBookDTO>($"{_inventoryApiBaseUrl}/api/Books/{id}"); return(View(data)); }
public ActionResult List() { var data = ApiRequestWithFormUrlEncodedContent.Get <List <BookViewModel> >($"{_inventoryApiBaseUrl}/api/Books"); return(View(data)); }
public ActionResult UnreturnedBooks() { var data = ApiRequestWithFormUrlEncodedContent.Get <List <UnreturnedBookViewModel> >($"{_rentalApiBaseUrl}/api/unreturned_books"); return(View(data)); }
// GET: Customer public ActionResult _AjaxGetAllCustomers() { var data = ApiRequestWithFormUrlEncodedContent.Get <List <CustomerViewModel> >($"{_identityApiBaseUrl}/api/customers"); return(Json(data, JsonRequestBehavior.AllowGet)); }