public ActionResult Add()
        {
            var availableBooks = new ApiClient().GetData <List <BookViewModel> >("book/GetAvailableBooks");
            var model          = new NewRentViewModel()
            {
                Books = availableBooks.ToSelectListItems(x => x.Id, x => x.Title)
            };

            return(View(model));
        }
        public ActionResult Add(NewRentViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Books = new ApiClient().GetData <List <BookViewModel> >("book/GetAvailableBooks").ToSelectListItems(x => x.Id, x => x.Title);
                return(View(model));
            }

            new ApiClient().PostData <NewRentViewModel>("rent/New", model);
            return(RedirectToAction("Index"));
        }