コード例 #1
0
ファイル: CatalogController.cs プロジェクト: shaimaa2/Library
        public IActionResult Detail(int assetid)
        {
            var asset = _asset.GetById(assetid);

            var currentholds = _checkout.GetCurrentHolds(assetid)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkout.GetCurrentHoldPlaced(assetid),
                PatronName = _checkout.GetCurrentHoldPatronName(assetid)
            });

            var model = new AssetDetailModel
            {
                Id       = assetid,
                Title    = asset.Title,
                Year     = asset.Year,
                Cost     = asset.Cost,
                Status   = asset.Status.Name,
                ImageUrl = asset.ImageUrl,

                DeweyCallNamber  = _asset.GetDeweyIndex(assetid),
                AuthorOrDirector = _asset.GetDirectorOrAuthor(assetid),
                CurrentLocation  = _asset.GetCurrentlocation(assetid).Name,
                PatronName       = _checkout.GetCurrentCheckoutPatron(assetid),
                LatestCheckout   = _checkout.GetLatestCheckout(assetid),
                CheckoutHistory  = _checkout.GetCheckOutHistory(assetid),
                AssetHold        = currentholds,

                ISBN = _asset.GetIsbn(assetid),
                Type = _asset.GetType(assetid)
            };

            return(View(model));
        }
コード例 #2
0
        public IActionResult Detail(int id)
        {
            var asset = _assets.GetById(id);

            var model = new AssetDetailModel
            {
                AssetId          = id,
                Title            = asset.Title,
                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),
                ISBN             = _assets.GetIsbn(id)
            };

            return(View(model));
        }