示例#1
0
        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("d"),
                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.GetCurrentLocation(Id).Name,
                DeweyCallNumber   = _assets.GetDeweyIndex(Id),
                CheckOutHistories = _checkouts.GetCheckOutHistories(Id),
                ISBN              = _assets.GetIsbn(Id),
                LastestCheckout   = _checkouts.GetLatestCheckout(Id),
                PatronName        = _checkouts.GetCurrentCheckoutPatron(Id),
                CurrentHolds      = currentHolds
            };

            return(View(model));
        }