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

            var currentHolds = _checkouts.GetCurrentHolds(id).Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id),
                PatronName = _checkouts.GetCurrentHoldPatron(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,
                Dewey                        = _assets.GetDeweyIndex(id),
                CheckoutHistory              = _checkouts.GetCheckoutHistory(id),
                CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id),
                ISBN                         = _assets.GetIsbn(id),
                LatestCheckout               = _checkouts.GetLatestCheckout(id),
                CurrentHolds                 = currentHolds,
                PatronName                   = _checkouts.GetCurrentPatron(id)
            };

            return(View(model));
        }
コード例 #2
0
ファイル: CatalogController.cs プロジェクト: mnngocc/Library
        public IActionResult Checkout(int id) //Muon sach
        {
            var asset = _assets.Get(id);

            var model = new CheckoutModel
            {
                AssetId       = id,
                ImageUrl      = asset.ImageUrl,
                Title         = asset.Title,
                LibraryCardId = "",
                IsCheckedOut  = _checkouts.IsCheckedOut(id)
            };

            return(View(model));
        }
コード例 #3
0
ファイル: CatalogController.cs プロジェクト: mnngocc/Library
        public IActionResult Hold(int id) //Giu sach
        {
            var asset = _assets.Get(id);
            //HttpContext.Session.SetInt32("LibraryCard", patron_id.LibraryCard.Id);
            // msg += HttpContext.Session.GetInt32("LibraryCard");
            //msg += HttpContext.Session.GetString("username");
            var libCard = HttpContext.Session.GetInt32("LibraryCard");
            var model   = new CheckoutModel
            {
                AssetId       = id,
                ImageUrl      = asset.ImageUrl,
                Title         = asset.Title,
                LibraryCardId = libCard.ToString(),
                HoldCount     = _checkouts.GetCurrentHold(id).Count()
            };

            return(View(model));
            //return Content(msg);
        }