public IActionResult Detail(int id)
        {
            var asset = assets.GetById(id);

            var currentHolds = checkouts.GetCurrentHolds(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = checkouts.GetCurrentHoldPlaced(a.Id).ToString(),
                PatronName = checkouts.GetCurrentHoldPatronName(a.Id)
            });
            var model = new AssetDetailModel
            {
                AssetId          = id,
                Title            = asset.Title,
                Type             = assets.GetType(id),
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDirector = assets.GetAuthorOrDirector(id),
                CurrentLocation  = assets.GetLocation(id).Name,
                Dewey            = assets.GetDeweyIndex(id),
                CheckoutHistory  = checkouts.GetCheckoutHistory(id),
                ISBN             = assets.GetIsbn(id),
                LatestCheckout   = checkouts.GetLatestCheckout(id),
                PatronName       = checkouts.GetCurrentCheckoutPatron(id),
                CurrentHolds     = currentHolds
            };

            return(View(model));
        }
        public IActionResult Detail(int id)
        {
            var asset = _assets.GetById(id);


            IEnumerable <AssetHoldModel> currentHolds = _checkout.GetCurrentHolds(id)
                                                        .Select(x => new AssetHoldModel
            {
                PatronName    = _checkout.GetPatronName(x.LibraryCard.Id).ToString(),
                HoldPlaced    = x.HoldPlaced,
                LibraryCardId = x.LibraryCard.Id
            });

            IEnumerable <CheckoutHistoryModel> checkoutHistories = _checkout.CheckoutHistory(asset.Id)
                                                                   .Select(x => new CheckoutHistoryModel
            {
                PatronName  = _checkout.GetPatronName(x.LibraryCard.Id).ToString(),
                CheckIn     = x.CheckIn,
                Checkout    = x.CheckOut,
                LibraryCard = x.LibraryCard
            });


            var displayAsset = new AssetDetailModel
            {
                Id                = asset.Id,
                PatronName        = _checkout.GetPatronName(4).FirstName,
                ImageUrl          = asset.ImgUrl,
                Title             = asset.Title,
                Year              = asset.Year,
                Cost              = asset.Cost,
                Status            = _assets.GetStatus(asset.Id).Name,
                AuthorOrDirector  = _assets.GetAuthorOrDirector(asset.Id),
                DeweyIndex        = _assets.GetDeweyIndex(asset.Id),
                NumberOfCopies    = asset.NumberOfCopies,
                Type              = _assets.GetType(asset.Id),
                CurrentLocation   = _assets.GetLocation(asset.Id).Name,
                ISBN              = _assets.GetISBN(id),
                CheckoutHistories = checkoutHistories,
                CurrentHolds      = currentHolds
            };

            return(View(displayAsset));
        }