Пример #1
0
 public IActionResult ListBook()
 {
     if (HttpContext.Session.GetString("username") != null)
     {
         var assetModels   = _assets.GetAll();
         var ListingResult = assetModels
                             .Select(result => new BookIndexListingModel
         {
             Id               = result.Id,
             ImageURL         = result.ImageUrl,
             AuthorOrDirector = _assets.GetAuthorOrDirector(result.Id),
             DeweyCallNumber  = _assets.GetDeweyIndex(result.Id),
             Title            = result.Title,
             NumberOfCopies   = result.NumberOfCopies.ToString(),
             Year             = result.Year.ToString(),
             Status           = result.Status.ToString(),
             Cost             = result.Cost.ToString(),
             Location         = _asset.GetCurrentLocation(result.Id)?.Name.ToString()
                                // Location = result.Location.Name
         });
         var model = new BookIndexModel()
         {
             Books = ListingResult
         };
         return(View(model));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Пример #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));
        }
        public IActionResult Detail(int id)
        {
            var asset = _assets.GetById(id);

            var currentHolds = _checkout.GetCurrentHolds(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkout.GetCurrentHoldPlaced(a.Id),
                PatronName = _checkout.GetCurrentHoldPatronName(a.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.GetDewayIndex(id),
                CheckoutHistories = _checkout.GetCheckOutHistory(id),
                ISBN              = _assets.GetIsbn(id),
                LatestCheckout    = _checkout.GetLatestCheckout(id),
                PatronName        = _checkout.GetCurrentCheckoutPatron(id),
                CurrentHolds      = currentHolds
            };

            return(View(model));
        }
        public IActionResult Detail(int id)
        {
            var asset = _ILibraryAsset.GetById(id);

            var currentHolds = _ICheckout.GetCurrentHolds(id)
                               .Select(result => new AssetHoldModel
            {
                HoldPlaced = _ICheckout.GetCurrentHoldPlaced(result.Id).ToString("d"),
                PatronName = _ICheckout.GetCurrentHoldPatronName(result.Id),
            });

            var model = new AssetDetailModel()
            {
                AssetId          = id,
                Title            = asset.Title,
                AuthorOrDirector = _ILibraryAsset.GetAuthorOrDirector(id),
                Type             = _ILibraryAsset.GetType(id),
                Year             = asset.Year,
                ISBN             = _ILibraryAsset.GetIsbn(id),
                DeweyCallNumber  = _ILibraryAsset.GetDeweyIndex(id),
                Status           = asset.Status.Name,
                Cost             = asset.Cost,
                CurrentLocation  = _ILibraryAsset.GetCurrentLocation(id).Name,
                ImageUrl         = asset.ImageURL,
                CheckoutHistory  = _ICheckout.GetCheckoutHistories(id),
                LatestCheckout   = _ICheckout.GetLatestCheckout(id),
                PatronName       = _ICheckout.GetCurrentCheckoutPatron(id),
                CurrentHolds     = currentHolds,
            };

            return(View(model));
        }
        public IActionResult Details(int id)
        {
            var asset        = _assets.GetById(id);// retrieve an asset from the db represented in the form of domain model
            var currentHolds = _checkouts.GetCurrentHolds(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString("d"),
                PatronName = _checkouts.GetCurrentHoldPatronName(a.Id)
            });
            var model = new AssetDetailModel    // pass it to the view in the form of the view model that we just created
            {
                AssetId          = id,
                Title            = asset.Title,
                Type             = _assets.GetType(id),
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthotOrDirector = _assets.GetAuthorOrDirector(id),
                CurrentLocation  = _assets.GetCurrentLocation(id).Name,
                DeweyCallNumber  = _assets.GetDeweyIndex(id),
                ISBN             = _assets.GetIsbn(id),
                LatestCheckout   = _checkouts.GetLatestCheckout(id),
                CheckoutHistory  = _checkouts.GetCheckoutHistory(id),
                PatronName       = _checkouts.GetCurrentPatron(id),
                CurrentHolds     = currentHolds
            };

            return(View(model));
        }
Пример #6
0
        public IActionResult Detail(int id)
        {
            LibraryAsset asset = _assets.GetById(id);

            IEnumerable <AssetHoldModel> currentHolds = _checkouts.GetCurrentHolds(asset.Id)
                                                        .Select(h => new AssetHoldModel
            {
                HoldPlaced = h.HoldPlaced.ToShortDateString(),
                PatronName = _checkouts.GetCurrentHoldPatronName(h.Id)
            });

            AssetDetailModel model = new AssetDetailModel()
            {
                AssetId          = asset.Id,
                Title            = asset.Title,
                Year             = asset.Year,
                DeweyCallNumber  = _assets.GetDeweyIndex(asset.Id),
                ISBN             = _assets.GetIsbn(asset.Id),
                Type             = _assets.GetType(asset.Id),
                ImageUrl         = asset.ImageUrl,
                Cost             = asset.Cost,
                AuthorOrDirector = _assets.GetAuthorOrDirector(asset.Id),
                CurrentLocation  = _assets.GetCurrentLocation(asset.Id).Name,
                Status           = asset.Status.Name,
                CheckoutHistory  = _checkouts.GetCheckoutHistory(asset.Id),
                CurrentHolds     = currentHolds,
                LatestCheckout   = _checkouts.GetLatestCheckout(asset.Id),
                PatronName       = _checkouts.GetCurrentCheckoutPatron(asset.Id),
            };

            return(View(model));
        }
Пример #7
0
        public IActionResult Detail(int assetId)
        {
            var asset = assets.GetById(assetId);

            var currentHolds = checkouts.GetCurrentHolds(assetId)
                               .Select(a => new AssetHoldModel
            {
                DateHoldPlaced = checkouts.GetCurrentHoldPlaced(a.Id).ToString("d"),
                PatronName     = checkouts.GetCurrentHoldPatronName(a.Id)
            });

            var model = new AssetDetailModel
            {
                AssetId          = assetId,
                Title            = asset.Title,
                Type             = assets.GetType(assetId),
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDirector = assets.GetAuthorOrDirector(assetId),
                CurrentLocation  = assets.GetCurrentLocation(assetId).Name,
                Dewey            = assets.GetDeweyIndex(assetId),
                ISBN             = assets.GetISBN(assetId),
                CheckoutHistory  = checkouts.GetCheckoutHistory(assetId),
                LatestCheckout   = checkouts.GetLatestCheckout(assetId),
                PatronName       = checkouts.GetCurrentCheckoutPatron(assetId),
                CurrentHolds     = currentHolds
            };

            return(View(model));
        }
Пример #8
0
        public IActionResult Detail(int id)
        {
            //retrieve the asset:
            var asset = _assets.GetById(id);

            var currentHolds = _checkouts.GetCurrentHolds(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id),
                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 is the navigation property that itself contains properties,
                //we'llbe looking for the sstatus name here:
                Status           = asset.Status.Name,
                ImageURL         = asset.ImageUrl,
                AuthorOrDirector = _assets.GetAuthorOrDirector(id),
                CurrentLocation  = _assets.GetCurrentLocation(id).Name,
                DeweyCallNumber  = _assets.GetDeweyIndex(id),
                ISBN             = _assets.GetIsbn(id),
                CheckoutHistory  = _checkouts.GetCheckoutHistory(id),
                LatestChekout    = _checkouts.GetLatestCheckout(id),
                PatronName       = _checkouts.GetCurrentHoldPatronName(id),
                CurrentHolds     = currentHolds,
            };

            return(View(model));
        }
Пример #9
0
        public IActionResult Detail(int id)
        {
            var asset = _interface.GetById(id);

            var currentHolds = _checkOutInterface.GetCurrentHolds(id).Select(e => new AssetHoldModel
            {
                HoldPlaced = _checkOutInterface.GetCurrentHoldPlaced(e.ID),
                PatronName = _checkOutInterface.GetCurrentHoldPatronName(e.ID)
            });

            var model = new Catalog_DetailVM
            {
                ID               = asset.ID,
                title            = asset.Title,
                authorOrDirector = _interface.GetAuthorOrDirector(id),
                type             = _interface.GetType(id),
                year             = asset.Year,
                ISBN             = _interface.GetISBN(id),
                deweyCallNumber  = _interface.GetDeweyIndex(id),
                status           = asset.Status.Name,
                cost             = asset.Cost,
                currentLocation  = _interface.GetCurrentLocation(id).Name,
                imageUrl         = asset.ImageUrl,

                CheckOutHistory = _checkOutInterface.GetCheckOutHistorie(id),
                //LatestCheckOut=_checkOutInterface.GetLatestCheckOut(id),
                patronName  = _checkOutInterface.GetCurrentCheckOutPatron(id),
                CurrenHolds = currentHolds
            };

            return(View(model));
        }
        public IActionResult Detail(int Id)
        {
            var asset = _assetServices.GetById(Id);

            var currentHolds = _checkoutsService.GetCurrentHolds(Id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkoutsService.GetCurrentHoldPlaced(a.Id),
                PatronName = _checkoutsService.GetCurrentHoldPatron(a.Id)
            });

            var model = new AssetDetailViewModel
            {
                AssetId          = Id,
                Title            = asset.Title,
                Type             = _assetServices.GetType(Id),
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDirector = _assetServices.GetAuthorOrDirector(Id),
                //get current location(name) base on the ID
                CurrentLocation = _assetServices.GetCurrentLocation(Id)?.Name,
                DeweyCallNumber = _assetServices.GetDeweyIndex(Id),
                CheckoutHistory = _checkoutsService.GetCheckoutHistory(Id),
                // CurrentAssociatedLibraryCard = _assetServices.GetLibraryCardByAssetId(Id),
                ISBN           = _assetServices.GetIsbn(Id),
                LatestCheckout = _checkoutsService.GetLatestCheckout(Id),
                CurrentHolds   = currentHolds,
                PatronName     = _checkoutsService.GetCurrentPatron(Id)
            };

            return(View(model));
        }
Пример #11
0
        public IActionResult Detail(int id)
        {
            var asset = _assets.GetById(id);

            var currentHolds = _checkouts.GetCurrentHolds(id)
                               .Select(asset => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(asset.Id).ToString("d"),
                PatronName = _checkouts.GetCurrentHoldPatronName(asset.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),
                // Here a LibraryBranch Object is being returned so we only want the name on that object
                CurrentLocation = _assets.GetCurrentLocation(id).Name,
                DeweyCallNumber = _assets.GetDeweyIndex(id),
                ISBN            = _assets.GetIsbn(id),
                CheckoutHistory = _checkouts.GetCheckoutHistory(id),
                LatestCheckout  = _checkouts.GetLatestCheckout(id),
                PatronName      = _checkouts.GetCurrentCheckoutPatron(id),
                CurrentHolds    = currentHolds
            };

            return(View(model));
        }
Пример #12
0
        public IActionResult Detail(int id)
        {
            var asset = _assets.GetAsset(id);

            var currentHolds = _checkout.GetCurrentHolds(id).Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkout.GetCurrentHoldPlaced(a.Id).ToString("d"),
                PatronName = _checkout.GetCurrentHoldPatronName(a.Id)
            });

            var model = new AssetDetailModel
            {
                AssetId          = id,
                Title            = asset.Title,
                Type             = _assets.GetType(id),
                Year             = asset.Year,
                Cost             = asset.Cost,
                Isbn             = _assets.GetIsbn(id),
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDirector = _assets.GetAuthorOrDirector(id),
                CurrentLocation  = _assets.GetCurrentLocation(id)?.Name,
                Dewey            = _assets.GetDewyIndex(id),
                CheckoutHistory  = _checkout.GetCheckoutHistories(id),
                //   CurrentAssociatedLibraryCard = _ass,
                //  Isbn = _assets.GetIsbn(id),
                latestCheckout = _checkout.GetLatestCheckout(id),
                CurrentHolds   = currentHolds,
                PatronName     = _checkout.GetCurrentCheckoutPatron(id)
            };

            return(View(model));
        }
        public IActionResult Detail(int id)
        {
            //if (ModelState.IsValid)
            //{
            //    LibraryAsset asset = assets.GetById(id);

            //    AssetDetailModel model = new AssetDetailModel()
            //    {
            //        AssetId = id,
            //        Title = asset.Title,
            //        AuthorOrDirector = assets.GetAuthorOrDirection(id),
            //        //Type = assets.GetType(id),
            //        Year = asset.Year,
            //        ISBN = assets.GetIsbn(id),
            //        DeweyCallNumber = assets.GetDeweyIndex(id),
            //        Status = asset.Status.Name,
            //        Cost = asset.Cost,
            //        CurrentLocation = assets.GetCurrentLocation(id).Name,
            //        ImageUrl = asset.ImageUrl
            //        //PatronName = assets.

            //    };

            if (ModelState.IsValid)
            {
                LibraryAsset asset = assets.GetById(id);
                IEnumerable <AssetHoldModel> currentHolds = checkout.GetCurrentHolds(id)
                                                            .Select(a => new AssetHoldModel
                {
                    HoldIsPlaced = checkout.GetCurrentHoldPlaced(id).ToString("d"),
                    PatronName   = checkout.GetCurrentPatronName(id)
                });

                AssetDetailModel 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),
                    CheckoutHistory  = checkout.GetCheckoutHistory(id),
                    ISBN             = assets.GetIsbn(id),
                    LastestCheckOut  = checkout.GetLatestCheckout(id),
                    PatronName       = checkout.GetCurrentPatronName(id),
                    AssetHolds       = currentHolds
                };
                return(View(model));
            }
            return(View("Error"));
            //  return View(model);
            //  }
            //   return View("Error");
        }
Пример #14
0
        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.GetType(result.Id),
                CurrentLocation  = _assets.GetCurrentLocation(result.Id)?.Name
            });
            var model = new AssetIndexModel()
            {
                Assets = ListingResult
            };

            return(View(model));
        }
Пример #15
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,
            //    Dewey = _assets.GetDeweyIndex(id),
            //    Isbn = _assets.GetIsbn(id)

            //};

            var asset = _assets.GetById(id);

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

            return(View(model));
        }
        public IActionResult Detail(int id)
        {
            int libraryCardId;
            var asset = _assets.GetById(id);

            var currentHolds = _checkouts.GetCurrentHolds(id)
                               .Select(p => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(p.Id).ToString("d"),
                PatronName = _checkouts.GetCurrentHoldPatronName(p.Id)
            });



            var firstHold = _checkouts.GetLastestHold(id);


            if (firstHold == null)
            {
                libraryCardId = 0;
            }
            else
            {
                libraryCardId = firstHold.LibraryCard.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),
                CheckoutHistory        = _checkouts.GetCheckoutHistories(id),
                ISBN                   = _assets.GetIsbn(id),
                LatestCheckout         = _checkouts.GetLastestCheckout(id),
                PatronName             = _checkouts.GetCurrentCheckoutPatron(id),
                FirstHoldLibraryCardId = libraryCardId,
                CurrentHolds           = currentHolds
            };

            return(View(model));
        }
Пример #17
0
        //Returns the details for a selected asset
        public IActionResult Detail(int id)
        {
            //Selects the required asset
            LibraryAsset asset = _assets.GetById(id);

            var currentHolds = _checkouts.GetCurrentHolds(id)
                               .Select(a => new AssetHoldModel
            {
                HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString("d"),
                PatronName = _checkouts.GetCurrentHoldPatronName(a.Id)
            });

            var currentCheckoutHistory = _checkouts.GetCheckoutHistory(id)
                                         .Select(a => new AssetCheckoutHistoryModel
            {
                Id            = id,
                PatronName    = _checkouts.GetCurrentCheckedOutPatronName(a.Id),
                CheckedOut    = _checkouts.CheckedOut(a.Id),
                CheckedIn     = _checkouts.CheckedIn(a.Id),
                LibraryCardId = a.LibraryCard.Id
            });

            //Creates the ViewModel
            //Populate the AssetDetail model with:
            // LibraryAsset properties OR
            // services from the _assets ILibrary service
            AssetDetailModel model = new AssetDetailModel()
            {
                AssetId                = id,
                Title                  = asset.Title,
                Year                   = asset.Year,
                Status                 = asset.Status.Name,
                Cost                   = asset.Cost,
                ImageUrl               = asset.ImageUrl,
                AuthorOrDirector       = _assets.GetAuthorOrDirector(id),
                CurrentLocation        = _assets.GetCurrentLocation(id).Name,
                Type                   = _assets.GetType(id),
                DeweyCallNumber        = _assets.GetDeweyIndex(id),
                ISBN                   = _assets.GetIsbn(id),
                CheckoutHistory        = _checkouts.GetCheckoutHistory(id),
                LatestCheckOut         = _checkouts.GetLatestCheckout(id),
                PatronName             = _checkouts.GetCurrentCheckoutPatron(id),
                CurrentHolds           = currentHolds,
                CurrentCheckoutHistory = currentCheckoutHistory
            };

            return(View(model));
        }
Пример #18
0
        public IActionResult Detail(int id)
        {
            var asset = _assets.Get(id);

            //var currentHolds = _checkoutsService.GetCurrentHolds(id).Select(a => new AssetHoldModel
            //{
            //    HoldPlaced = _checkoutsService.GetCurrentHoldPlaced(a.Id),
            //    PatronName = _checkoutsService.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 = _assets.GetCheckoutHistory(id),
            //    CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id),
            //    Isbn = _assetsService.GetIsbn(id),
            //    LatestCheckout = _checkoutsService.GetLatestCheckout(id),
            //    CurrentHolds = currentHolds,
            //    PatronName = _checkoutsService.GetCurrentPatron(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));
        }
Пример #19
0
        public IActionResult Detail(int id)
        {
            var asset = _assets.GetById(id);
            var model = new AssetDetailModel
            {
                AssetId         = id,
                Title           = asset.Title,
                Year            = asset.Year,
                Status          = asset.Status.Name,
                ImageUrl        = asset.ImageUrl,
                Author          = _assets.GetAuthor(id),
                CurrentLocation = _assets.GetCurrentLocation(id).Name,
                ISBN            = _assets.GetBookIndex(id),
                BookIndex       = _assets.GetBookIndex(id)
            };

            return(View(model));
        }
Пример #20
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));
        }
Пример #21
0
        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"),
            //        PatronName = _checkouts.GetCurrentHoldPatronName(a.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,
                DeweyCallNumber  = _assets.GetDeweyIndex(id),
                ISBM             = _assets.GetIsbn(id),
                CheckoutHistory  = _checkouts.GetCheckoutHistory(id),
                //CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id),
                LatestCheckout = _checkouts.GetLatestCheckout(id),
                PatronName     = _checkouts.GetCurrentHoldPatron(id),
                CurrentHolds   = currentHolds
            };

            return(View(model));
        }