Exemple #1
0
        public IActionResult Index()
        {
            var assetModels = _asset.GetAll();

            var listingResult = assetModels
                                .Select(a => new AssetIndexListingModel
            {
                Id               = a.Id,
                ImageUrl         = a.ImageUrl,
                AuthorOrDirector = _asset.GetAuthorOrDirector(a.Id),
                DeweyCallNumber  = _asset.GetDeweyIndex(a.Id),
                // CopiesAvailable = _checkout.GetNumberOfCopies(a.Id), // Remove
                Title = _asset.GetTitle(a.Id),
                Type  = _asset.GetType(a.Id),
                //NumberOfCopies = _checkout.GetNumberOfCopies(a.Id)
            });

            var model = new AssetIndexModel
            {
                Assets = listingResult,
                Title  = "Library Catalog"
            };

            return(View(model));
        } //index
Exemple #2
0
        public IActionResult Detail(int id)
        {
            var patron = _Patron.GetById(id);

            var currentPatronHold = _Hold.GetByLibraryPatronId(patron.LibraryCard.Id)
                                    .Select(result => new PatronHoldDetailModel {
                AssetId    = result.LibraryAsset.Id,
                HoldPlaced = result.HoldPlaced,
                AssetTitle = _Asset.GetTitle(result.LibraryAsset.Id)
            });

            var currentPatronCheckout = _Checkout.GetCheckoutPatronDetails(patron.LibraryCard.Id)
                                        .Select(result => new PatronCheckoutDetailModel
            {
                LibraryAssetId = result.LibraryAsset.Id,
                LibraryCardId  = result.LibraryCard.Id,
                AssetTitle     = _Asset.GetTitle(result.LibraryAsset.Id),
                Since          = result.Since,
                Until          = result.Until
            });

            var model = new PatronDetailModel()
            {
                Id              = patron.Id,
                LastName        = patron.LastName,
                FirstName       = patron.FirstName,
                Address         = patron.Address,
                Telephone       = patron.TelephoneNumber,
                Branch          = patron.HomeLibraryBranch.Name,
                DateOfBirth     = patron.DateOfBirth,
                Fee             = patron.LibraryCard.Fees,
                PatronHolds     = currentPatronHold,
                PatronCheckouts = currentPatronCheckout,
                LibraryCardId   = patron.LibraryCard.Id
            };


            return(View(model));
        }
        public IActionResult Index()
        {
            var assetModels   = _assets.GetAll();
            var listingResult = assetModels
                                .Select(result => new AssetIndexListingModel
            {
                Id               = result.Id,
                ImageUrl         = result.ImageUrl,
                AuthorOrDirector = _assets.GetAuthorOrDirector(result.Id),
                DeweyCallNumber  = _assets.GetDeweyIndex(result.Id),
                Title            = result.Title,
                Type             = _assets.GetTitle(result.Id)
            });
            var model = new AssetIndexModel()
            {
                Assets = listingResult
            };

            return(View(model));
        }
        public IActionResult Index()
        {
            var assetModels   = _assets.GetAll();
            var listingResult = assetModels
                                .Select(a => new AssetIndexListingModel
            {
                Id               = a.Id,
                ImageUrl         = a.ImageUrl,
                AuthorOrDirector = _assets.GetAuthorOrDirector(a.Id),
                Dewey            = _assets.GetDeweyIndex(a.Id),
                Title            = _assets.GetTitle(a.Id),
                Type             = _assets.GetType(a.Id),
            }).ToList();
            var model = new AssetIndexModel
            {
                Assets = listingResult
            };

            return(View(model));
        }