public async Task <IActionResult> Detail(int id) { var patron = await _patronService.Get(id); var assetsCheckedOut = await _patronService.GetPaginatedCheckouts(patron.Id, 1, 10); var checkoutHistory = await _patronService.GetPaginatedCheckoutHistory(patron.Id, 1, 10); var holds = await _patronService.GetPaginatedHolds(patron.Id, 1, 10); var memberLengthOfTime = TimeSpanHumanizer.GetReadableTimespan(DateTime.UtcNow - patron.CreatedOn); var model = new PatronDetailModel() { Id = patron.Id, FirstName = patron.FirstName, LastName = patron.LastName, Email = patron.Email, LibraryCardId = patron.LibraryCardId, Address = patron.Address, Telephone = patron.Telephone, HomeLibrary = patron.HomeLibrary, OverdueFees = patron.OverdueFees, AssetsCheckedOut = assetsCheckedOut, CheckoutHistory = checkoutHistory, Holds = holds, HasBeenMemberFor = memberLengthOfTime }; return(View(model)); }
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", Kp = patron.HomeLibraryBranch?.Name ?? "No Home Library", // Laan = // Bank = Telephone = string.IsNullOrEmpty(patron.Telephone) ? "No Telephone Number Provided" : patron.Telephone, }; return(View(model)); }
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)); }
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); }