コード例 #1
0
        public IActionResult Detail(int id)
        {
            var asset = _asset.GetById(id);

            var currentholds = _checkout
                               .GetCurrentHolds(id)
                               .Select(h => new AssetHoldModel
            {
                HoldPlaced = _checkout.GetCurrentHoldPlaced(h.Id).ToString("d"),
                PatronName = _checkout.GetCurrentHoldPatronName(h.Id)
            });

            var model = new AssetDetailModel
            {
                AassetId         = id,
                Tittle           = asset.Title,
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDirector = _asset.getAuthorOrDirector(id),
                CurrentLocation  = _asset.getCurrentLocation(id).Name,
                DeweyCallNumber  = _asset.getDeweyIndex(id),
                ISBN             = _asset.getISBN(id),
                Type             = _asset.getType(id),
                CheckoutHistory  = _checkout.GetCheckOutHistory(id),
                LatestCheckout   = _checkout.GetLatestCheckouts(id),
                PatronName       = _checkout.GetCurrentHoldPatronName(id),
                CurrentHolds     = currentholds
            };

            return(View(model));
        }