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)); }
public IActionResult Detail(int id) { var asset = _libraryAsset.GetById(id); var currentHolds = _checkOut.GetCurrentHolds(id) .Select(a => new AssetHoldModel { HoldPlaced = _checkOut.GetCurrentHoldPlaced(a.Id).ToString("d"), 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 = _libraryAsset.GetAuthorOrDirector(id), CurrentLocation = _libraryAsset.GetCurrentLocation(id).Name, DeweyCallNumber = _libraryAsset.GetDeweyIndex(id), ISBN = _libraryAsset.GetISBN(id), LatestCheckout = _checkOut.GetLatestCheckOut(id), CheckoutHistory = _checkOut.GetCheckOutHistory(id), PatronName = _checkOut.GetCurrentHoldPatronName(id), CurrentHolds = currentHolds }; return(View(model)); }
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)); }
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)); }
// 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)); }