public IActionResult Detail(int patronId)
        {
            var patron = _patronService.Get(patronId);

            var model = new PatronDetailModel()
            {
                FirstName         = patron.FirstName,
                LastName          = patron.LastName,
                Address           = patron.Address,
                HomeLibraryBranch = patron.HomeLibraryBranch.Name,
                MemberSince       = patron.LibraryCard.Created,
                OverdueFees       = Math.Round(patron.LibraryCard.Fees, 2),
                LibraryCardId     = patron.LibraryCard.LibraryCardId,
                Telephone         = patron.TelephoneNumber,
                AssetsCheckedOut  = _patronService.GetCheckouts(patronId).ToList() ?? new List <Checkout>(),
                CheckoutHistory   = _patronService.GetCheckoutHistory(patronId),
                Holds             = _patronService.GetHolds(patronId)
            };

            return(View(model));
        }
Exemple #2
0
        public IActionResult Detail(int id)
        {
            var patron = _patronService.Get(id);

            var model = new PatronDetailModel
            {
                Id               = patron.Id,
                LastName         = patron.LastName ?? "No Last Name Provided",
                FirstName        = patron.FirstName ?? "No First Name Provided",
                Address          = patron.Address ?? "No Address Provided",
                HomeLibrary      = patron.HomeLibraryBranch?.Name ?? "No Home Library",
                MemberSince      = patron.LibraryCard?.Created,
                OverdueFees      = patron.LibraryCard?.Fees,
                LibraryCardId    = patron.LibraryCard?.Id,
                Telephone        = string.IsNullOrEmpty(patron.Telephone) ? "No Telephone Number Provided" : patron.Telephone,
                AssetsCheckedOut = _patronService.GetCheckouts(id).ToList(),
                CheckoutHistory  = _patronService.GetCheckoutHistory(id),
                Holds            = _patronService.GetHolds(id)
            };

            return(View(model));
        }
        public IActionResult Detail(int id)
        {
            var patron = _patronService.Get(id);

            var model = new PatronDetailModel
            {
                LastName = patron.LastName,
                FirstName = patron.FirstName,
                Address = patron.Address,
                Gender = patron.Gender,
                HomeLibrary = patron.HomeLibraryBranch.Name,
                MemberSince = patron.LibraryCard.Created,
                OverdueFees = patron.LibraryCard.Fees,
                LibraryCardId = patron.LibraryCard.Id,
                Telephone = patron.Telephone,
                AssetsCheckedOut = _patronService.GetCheckouts(id).ToList(),
                CheckoutHistory = _patronService.GetCheckoutHistory(id),
                Holds = _patronService.GetHolds(id)
            };

            return View(model);
        }