public IActionResult Detail(int id)
        {
            var asset       = _assets.GetById(id);
            var currentHold = _checkouts.GetHolds(id).Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString("d"),
                PatronName = _checkouts.GetCurrentHoldPatronName(a.Id)
            });
            var model = new AssetDetailModel
            {
                Id                = id,
                Title             = asset.Titel,
                Year              = asset.Year,
                Cost              = asset.Cost,
                Status            = asset.Status.Name,
                ImageUrl          = asset.ImageUrl,
                AuthorOrDirector  = _assets.getAuthorOrDirector(id),
                CurrentLocation   = _assets.GetLibraryBranch(id).Name,
                DeweyCallNumber   = _assets.getDeweyIndex(id),
                ISBN              = _assets.getIsbn(id),
                CheckoutHistories = _checkouts.GetCheckoutHistories(id),
                LatestCheckout    = _checkouts.GetLatestCheckout(id),
                PatronName        = _checkouts.getCurrentCheckoutPatron(id),
                CurrentHold       = currentHold
            };

            return(View(model));
        }
Beispiel #2
0
        // GET: Catalog/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var a = await _assets.GetById(id);

            var newAsset = new AssetDetailViewModel
            {
                Id               = a.Id,
                ImgUrl           = a.ImgUrl,
                Title            = a.Title,
                AuthorOrDirector = await _assets.GetAuthorOrDirector(a.Id),
                Type             = await _assets.GetType(a.Id),
                DeweyNumber      = await _assets.GetDeweyIndex(a.Id),
                Year             = a.Year,
                ISBN             = await _assets.GetISBN(a.Id),
                Status           = a.Status.Name,
                Price            = a.Price,
                CurrentLocation  = _assets.GetLibraryBranch(a.Id).Result.Name,
            };


            return(View(newAsset));
        }