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)); }
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)); }