//public IActionResult Detail(int id) //{ // var asset = _asset.GetById(id); // var model = new AseetDetailModel // { // AssetId = asset.Id, // Title = asset.Title, // Cost = asset.Cost, // Year = asset.Year, // ImageURL = asset.ImageUrl, // Status = asset.Status.Name, // CurrentLocation = _asset.GetCurrentLocations(id).Name, // DeweyCallNumber = _asset.GetDeweyIndex(id), // ISBN = _asset.GetIsbn(id), // AuthorOrDirector = _asset.AuthorOrDirector(id), // }; // return View(model); //} public IActionResult Detail(int id) { var asset = _asset.GetById(id); var currentHolds = _checkouts.GetCurrentHolds(id).Select(a => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString("d"), PatronName = _checkouts.GetCurrentHoldPatron(a.Id) }); var model = new AseetDetailModel { AssetId = asset.Id, Title = asset.Title, Cost = asset.Cost, Year = asset.Year, ImageURL = asset.ImageUrl, Status = asset.Status.Name, CurrentLocation = _asset.GetCurrentLocations(id).Name, DeweyCallNumber = _asset.GetDeweyIndex(id), ISBN = _asset.GetIsbn(id), AuthorOrDirector = _asset.AuthorOrDirector(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), LatestCheckout = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentCheckoutPatron(id), CurrentHold = currentHolds }; return(View(model)); }