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"),    //d is for short date format
                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),
                ISBN             = _assets.GetIsbn(id),

                CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id),
                CheckoutHistory = _checkouts.GetCheckoutHistory(id),
                LatestCheckout  = _checkouts.GetLatestCheckout(id),
                CurrentHolds    = currentHolds,
                PatronName      = _checkouts.GetCurrentCheckoutPatron(id)
            };

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

            var currentHolds = _checkouts.GetCurrentHold(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced  = _checkouts.GetCurrentHoldPlaced(a.Id).ToString(),
                PatronName  = _checkouts.GetCurrentHoldPatron(a.Id),
                PatronPhone = _checkouts.GetCurrentHoldPatronPhone(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), //Ham duoc viet cho lop Interface -  Services
                CurrentLocation              = _assets.GetCurrentLocation(id)?.Name,
                Dewey                        = _assets.GetDeweyIndex(id),
                Isbn                         = _assets.GetIsbn(id),
                CheckoutHistory              = _checkouts.GetCheckoutHistory(id),
                CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id),
                LatestCheckout               = _checkouts.GetLatestCheckout(id),
                PatronName                   = _checkouts.GetCurrentPatron(id),
                CurrentHolds                 = currentHolds
            };

            return(View(model));
        }
示例#3
0
        public IActionResult Detail(int id)
        {
            int  libCard = 0;
            bool isLogin = false;

            if (HttpContext.Session.GetString("username") != null)
            {
                libCard = (int)HttpContext.Session.GetInt32("LibraryCard");
                isLogin = true;
            }

            var asset        = _assets.GetById(id);
            var currentHolds = _checkouts.GetCurrentHold(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString(),
                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), //Ham duoc viet cho lop Interface -  Services
                CurrentLocation              = _assets.GetCurrentLocation(id)?.Name,
                Dewey                        = _assets.GetDeweyIndex(id),
                Isbn                         = _assets.GetIsbn(id),
                CheckoutHistory              = _checkouts.GetCheckoutHistory(id),
                CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id),
                LatestCheckout               = _checkouts.GetLatestCheckout(id),
                PatronName                   = _checkouts.GetCurrentPatron(id),
                CheckHoldExist               = _checkouts.CheckHoldExist(id, libCard),
                CurrentHolds                 = currentHolds,
                IsLogin                      = isLogin
            };
            string msg = "";

            msg += _checkouts.CheckHoldExist(id, libCard);
            return(View(model));
            //msg += libCard;
            //return Content(msg);
        }