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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
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));
        }
コード例 #5
0
ファイル: CatalogController.cs プロジェクト: Mkasakka/Library
        public IActionResult Detail(int Id)
        {
            var asset        = _asset.GetById(Id);
            var currentholds = _checkOut.GetCurrentHolds(Id)
                               .Select(a => new AssetHoldModel
            {
                DateHoldPlaced = _checkOut.GetCurrentHoldPlaced(a.Id).ToString("d"),
                UserName       = _checkOut.GetCurrentHolduserName(a.Id)
            });
            var model = new AssetDetailModel
            {
                AssetId          = Id,
                Title            = asset.Title,
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDircetor = _asset.GetAuthorOrDirector(Id),
                CurrentLocation  = asset.Location.Name,
                DeweyCallNumber  = _asset.GetDewwyIndex(Id),
                ISBN             = _asset.GetIsbn(Id),
                CheckoutHistory  = _checkOut.GetCheckoutHistory(Id),
                LatestCheckOut   = _checkOut.GetLatestCheckout(Id),
                UserName         = _checkOut.GetCurrentCheckOutUserName(Id),
                CurrentHolds     = currentholds
            };

            return(View(model));
        }
コード例 #6
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));
        }
コード例 #7
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));
        }
コード例 #8
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"),    //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));
        }
コード例 #9
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));
        }
コード例 #10
0
        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));
        }
コード例 #11
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));
        }
コード例 #12
0
        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");
        }
コード例 #13
0
        public IActionResult Update(int id)
        {
            var query = _libraryAsset.GetById(id);

            if (query == null)
            {
                return(View());
            }
            return(View(query));
        }
コード例 #14
0
        private void UpdateAssetStatus(int assetId, string status)
        {
            //_context.LibraryAssets.FirstOrDefault(a => a.Id == assetId);
            LibraryAsset item = _asset.GetById(assetId);

            if (item != null)
            {
                _context.Update(item);
                item.Status = _context.Statuses.FirstOrDefault(s => s.Name == status);
                _context.SaveChanges();
            }
        }
コード例 #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));
        }
コード例 #16
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));
        }
コード例 #17
0
        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));
        }
コード例 #18
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));
        }
コード例 #19
0
ファイル: CatalogController.cs プロジェクト: mnngocc/Library
        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));
        }
コード例 #20
0
        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.GetCurrentHoldPatron(a.Id)
            });

            var model = new AssetDetailModel
            {
                AssetId          = id,
                Title            = asset.Tittle,
                Type             = assets.GetType(id),
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDirector = assets.GetAuthorOrDirector(id),
                CheckOutHistory  = checkOut.GetCheckOutHistory(id),
                ISBN             = assets.GetIsbn(id),
                LastChechOut     = checkOut.GetLatestCheckOut(id),
                PatronName       = checkOut.GetCurrentPatron(id),
                CurrentHolds     = currentHolds
            };

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


            IEnumerable <AssetHoldModel> currentHolds = _checkout.GetCurrentHolds(id)
                                                        .Select(x => new AssetHoldModel
            {
                PatronName    = _checkout.GetPatronName(x.LibraryCard.Id).ToString(),
                HoldPlaced    = x.HoldPlaced,
                LibraryCardId = x.LibraryCard.Id
            });

            IEnumerable <CheckoutHistoryModel> checkoutHistories = _checkout.CheckoutHistory(asset.Id)
                                                                   .Select(x => new CheckoutHistoryModel
            {
                PatronName  = _checkout.GetPatronName(x.LibraryCard.Id).ToString(),
                CheckIn     = x.CheckIn,
                Checkout    = x.CheckOut,
                LibraryCard = x.LibraryCard
            });


            var displayAsset = new AssetDetailModel
            {
                Id                = asset.Id,
                PatronName        = _checkout.GetPatronName(4).FirstName,
                ImageUrl          = asset.ImgUrl,
                Title             = asset.Title,
                Year              = asset.Year,
                Cost              = asset.Cost,
                Status            = _assets.GetStatus(asset.Id).Name,
                AuthorOrDirector  = _assets.GetAuthorOrDirector(asset.Id),
                DeweyIndex        = _assets.GetDeweyIndex(asset.Id),
                NumberOfCopies    = asset.NumberOfCopies,
                Type              = _assets.GetType(asset.Id),
                CurrentLocation   = _assets.GetLocation(asset.Id).Name,
                ISBN              = _assets.GetISBN(id),
                CheckoutHistories = checkoutHistories,
                CurrentHolds      = currentHolds
            };

            return(View(displayAsset));
        }
コード例 #22
0
        // GET: Catalog/Details/5
        public ActionResult Details(int id)
        {
            var asset = _asset.GetById(id);

            var currentHolds = _checkout.GetCurrentHolds(id)
                               .Select(a => new AssetHoldModel()
            {
                Patron      = _checkout.GetCurrentHoldPatron(a.Id),
                HolDateTime = _checkout.GetCurrentHoldPlacedTime(a.Id)
            });

            var model = new LibraryAssetDetailsDTO
            {
                Id                = id,
                Title             = asset.Title,
                Year              = asset.Year,
                Cost              = asset.Cost,
                AuthorOrDirector  = _asset.GetAuthorOrDirector(id),
                ImageUrl          = asset.ImageUrl,
                ISBN              = _asset.GetIsbn(id),
                CurrentLocation   = _asset.GetCurrentLibraryBranch(id).Name,
                Status            = asset.Status.Name,
                NumberOfCopies    = asset.NumberOfCopies,
                Type              = _asset.GetType(id),
                Patron            = _checkout.GetCurrentCheckoutPatron(id),
                CheckoutHistories = _checkout.GetCheckoutHistories(id),
                LatestCheckout    = _checkout.GetLatestCheckout(id),
                CurrentHolds      = currentHolds
            };

            //var model=new LibraryAssetDetailsApi
            //{
            //  LibraryAssetDetails = model
            //};
            return(View(model));
        }
コード例 #23
0
ファイル: CatalogController.cs プロジェクト: mnngocc/Library
        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);
        }
コード例 #24
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));
        }
コード例 #25
0
        //Necessário passar o id para o controller: www.site.com/Catalog/Detail/id
        public IActionResult Detail(int id)
        {   //Consulta feit a base, que retornara dados usados para construir o model e posteriormente retornar à View
            var asset = _assets.GetById(id);



            //Variavel do model, será construida com os dados da base:
            var model = new AssetDetailModel
            {
                AssetId          = id,
                Tittle           = asset.Title,
                Year             = asset.Year,
                Cost             = asset.Cost,
                Status           = asset.Status.Name,
                ImageUrl         = asset.ImageUrl,
                AuthorOrDirector = _assets.GetAuthorOrDirector(id),
                CurrentLocation  = _assets.CurrentLocation(id).Name,
            }
        }
コード例 #26
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));
        }
コード例 #27
0
ファイル: CatalogController.cs プロジェクト: codeavak/LMS
        // GET: Catalog/Details/5
        public async Task <ActionResult> Details(int id)
        {
            var a = await _assets.GetById(id);

            var newAsset = new AssetDetailViewModel
            {
                Id               = a.Id,
                ImgUrl           = a.ImgUrl,
                Title            = a.Title,
                AuthorOrDirector = await _assets.GetAuthorOrDirector(a.Id),
                Type             = await _assets.GetType(a.Id),
                DeweyNumber      = await _assets.GetDeweyIndex(a.Id),
                Year             = a.Year,
                ISBN             = await _assets.GetISBN(a.Id),
                Status           = a.Status.Name,
                Price            = a.Price,
                CurrentLocation  = _assets.GetLibraryBranch(a.Id).Result.Name,
            };


            return(View(newAsset));
        }
コード例 #28
0
 public IActionResult Detail(int id)
 {
     var asset = _asset.GetById(id);
 }