Exemple #1
0
        public IActionResult Detail(int id)
        {
            var asset = _asset.GetBYId(id);

            var curretnHolds = _checkOut.GetCurrentHolds(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkOut.GetCurrentHoldPlaced(a.Id).ToString("d"),
                PatronName = _checkOut.GetCurrentHoldPattronName(a.Id)
            });


            var model = new AssetDetailModel
            {
                AssetId           = id,
                Title             = asset.Title,
                Year              = asset.Year,
                Cost              = asset.Cost,
                Status            = asset.status.Name,
                ImageUrl          = asset.ImageUrl,
                AuthorOrDirector  = _asset.GetAuthorOrDirector(id),
                CurrentLocation   = _asset.GetCurrentLocatuon(id).Name,
                DeweyCallNumber   = _asset.GetDeweyIndex(id),
                CheckoutHistories = _checkOut.GetCheckoutHistories(id),
                ISBN              = _asset.GetIsbn(id),
                LatestCheckOut    = _checkOut.GetLatestCheckOut(id),
                PatronName        = _checkOut.GetCurrentCheckOutPattron(id),
                CurrentHolds      = curretnHolds
            };

            return(View(model));
        }