public IActionResult Detail(int id) { var asset = _ILibraryAsset.GetById(id); var currentHolds = _ICheckout.GetCurrentHolds(id) .Select(result => new AssetHoldModel { HoldPlaced = _ICheckout.GetCurrentHoldPlaced(result.Id).ToString("d"), PatronName = _ICheckout.GetCurrentHoldPatronName(result.Id), }); var model = new AssetDetailModel() { AssetId = id, Title = asset.Title, AuthorOrDirector = _ILibraryAsset.GetAuthorOrDirector(id), Type = _ILibraryAsset.GetType(id), Year = asset.Year, ISBN = _ILibraryAsset.GetIsbn(id), DeweyCallNumber = _ILibraryAsset.GetDeweyIndex(id), Status = asset.Status.Name, Cost = asset.Cost, CurrentLocation = _ILibraryAsset.GetCurrentLocation(id).Name, ImageUrl = asset.ImageURL, CheckoutHistory = _ICheckout.GetCheckoutHistories(id), LatestCheckout = _ICheckout.GetLatestCheckout(id), PatronName = _ICheckout.GetCurrentCheckoutPatron(id), CurrentHolds = currentHolds, }; return(View(model)); }
public IActionResult Detail(int Id) { var asset = _assetServices.GetById(Id); var currentHolds = _checkoutsService.GetCurrentHolds(Id) .Select(a => new AssetHoldModel { HoldPlaced = _checkoutsService.GetCurrentHoldPlaced(a.Id), PatronName = _checkoutsService.GetCurrentHoldPatron(a.Id) }); var model = new AssetDetailViewModel { AssetId = Id, Title = asset.Title, Type = _assetServices.GetType(Id), Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDirector = _assetServices.GetAuthorOrDirector(Id), //get current location(name) base on the ID CurrentLocation = _assetServices.GetCurrentLocation(Id)?.Name, DeweyCallNumber = _assetServices.GetDeweyIndex(Id), CheckoutHistory = _checkoutsService.GetCheckoutHistory(Id), // CurrentAssociatedLibraryCard = _assetServices.GetLibraryCardByAssetId(Id), ISBN = _assetServices.GetIsbn(Id), LatestCheckout = _checkoutsService.GetLatestCheckout(Id), CurrentHolds = currentHolds, PatronName = _checkoutsService.GetCurrentPatron(Id) }; return(View(model)); }
public IActionResult Detail(int id) { LibraryAsset asset = _assets.GetById(id); IEnumerable <AssetHoldModel> currentHolds = _checkouts.GetCurrentHolds(asset.Id) .Select(h => new AssetHoldModel { HoldPlaced = h.HoldPlaced.ToShortDateString(), PatronName = _checkouts.GetCurrentHoldPatronName(h.Id) }); AssetDetailModel model = new AssetDetailModel() { AssetId = asset.Id, Title = asset.Title, Year = asset.Year, DeweyCallNumber = _assets.GetDeweyIndex(asset.Id), ISBN = _assets.GetIsbn(asset.Id), Type = _assets.GetType(asset.Id), ImageUrl = asset.ImageUrl, Cost = asset.Cost, AuthorOrDirector = _assets.GetAuthorOrDirector(asset.Id), CurrentLocation = _assets.GetCurrentLocation(asset.Id).Name, Status = asset.Status.Name, CheckoutHistory = _checkouts.GetCheckoutHistory(asset.Id), CurrentHolds = currentHolds, LatestCheckout = _checkouts.GetLatestCheckout(asset.Id), PatronName = _checkouts.GetCurrentCheckoutPatron(asset.Id), }; return(View(model)); }
public IActionResult Detail(int Id) { var asset = _asset.GetById(Id); var currentholds = _checkOut.GetCurrentHolds(Id) .Select(a => new AssetHoldModel { DateHoldPlaced = _checkOut.GetCurrentHoldPlaced(a.Id).ToString("d"), UserName = _checkOut.GetCurrentHolduserName(a.Id) }); var model = new AssetDetailModel { AssetId = Id, Title = asset.Title, Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDircetor = _asset.GetAuthorOrDirector(Id), CurrentLocation = asset.Location.Name, DeweyCallNumber = _asset.GetDewwyIndex(Id), ISBN = _asset.GetIsbn(Id), CheckoutHistory = _checkOut.GetCheckoutHistory(Id), LatestCheckOut = _checkOut.GetLatestCheckout(Id), UserName = _checkOut.GetCurrentCheckOutUserName(Id), CurrentHolds = currentholds }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _assets.GetById(id); var currentHolds = _checkouts.GetCurrentHold(id) .Select(a => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString(), PatronName = _checkouts.GetCurrentHoldPatron(a.Id), PatronPhone = _checkouts.GetCurrentHoldPatronPhone(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), //Ham duoc viet cho lop Interface - Services CurrentLocation = _assets.GetCurrentLocation(id)?.Name, Dewey = _assets.GetDeweyIndex(id), Isbn = _assets.GetIsbn(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id), LatestCheckout = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentPatron(id), CurrentHolds = currentHolds }; 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), PatronName = _checkouts.GetCurrentHoldPatronName(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), CheckoutHistory = _checkouts.GetCheckoutHistory(id), ISBN = _assets.GetIsbn(id), Latestcheckout = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentCheckoutPatron(id), CurrentHold = currentHolds }; return(View(model)); }
public IActionResult Detail(int id) { //retrieve the asset: var asset = _assets.GetById(id); var currentHolds = _checkouts.GetCurrentHolds(id) .Select(a => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id), PatronName = _checkouts.GetCurrentHoldPatronName(a.Id), }); var model = new AssetDetailModel { AssetId = id, Title = asset.Title, Type = _assets.GetType(id), Year = asset.Year, Cost = asset.Cost, //status is the navigation property that itself contains properties, //we'llbe looking for the sstatus name here: Status = asset.Status.Name, ImageURL = asset.ImageUrl, AuthorOrDirector = _assets.GetAuthorOrDirector(id), CurrentLocation = _assets.GetCurrentLocation(id).Name, DeweyCallNumber = _assets.GetDeweyIndex(id), ISBN = _assets.GetIsbn(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), LatestChekout = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentHoldPatronName(id), CurrentHolds = currentHolds, }; return(View(model)); }
public IActionResult Details(int id) { var asset = _assets.GetById(id);// retrieve an asset from the db represented in the form of domain model var currentHolds = _checkouts.GetCurrentHolds(id) .Select(a => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString("d"), PatronName = _checkouts.GetCurrentHoldPatronName(a.Id) }); var model = new AssetDetailModel // pass it to the view in the form of the view model that we just created { AssetId = id, Title = asset.Title, Type = _assets.GetType(id), Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthotOrDirector = _assets.GetAuthorOrDirector(id), CurrentLocation = _assets.GetCurrentLocation(id).Name, DeweyCallNumber = _assets.GetDeweyIndex(id), ISBN = _assets.GetIsbn(id), LatestCheckout = _checkouts.GetLatestCheckout(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), PatronName = _checkouts.GetCurrentPatron(id), CurrentHolds = currentHolds }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _assets.GetById(id); var currenthold = _checkout.GetCurrentHolds(id) .Select(c => new AssetHoldModel { HoldPlaced = _checkout.GetCurrentHoldPlaced(c.Id).ToString("d"), PatronName = _checkout.GetCurrentHoldPatronName(c.Id) }); var model = new AssetDetailModel() { AssetId = id, Title = asset.Title, Year = asset.Year, Status = asset.Status.Name, ImageUrl = "img/13.jpg", //asset.ImageUrl, AuthorOrDirector = _assets.GetAuthorOrDirector(id), CurrentLocation = _assets.GetCurrentLocation(id).Name, DeweyCallNumber = _assets.GetDewayIndex(id), CheckOutHistory = _checkout.GetCheckoutHistory(id), ISBN = _assets.GetIsbn(id), LatestCheckout = _checkout.GetLatestCheckout(id), PatronName = _checkout.GetCurrentCheckoutPatron(id), CurrentHolds = currenthold, Cost = asset.Cost }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _assets.GetById(id); var currentHolds = _checkouts.GetCurrentHolds(id) .Select(asset => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(asset.Id).ToString("d"), PatronName = _checkouts.GetCurrentHoldPatronName(asset.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), // Here a LibraryBranch Object is being returned so we only want the name on that object CurrentLocation = _assets.GetCurrentLocation(id).Name, DeweyCallNumber = _assets.GetDeweyIndex(id), ISBN = _assets.GetIsbn(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), LatestCheckout = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentCheckoutPatron(id), CurrentHolds = currentHolds }; return(View(model)); }
} //index public IActionResult Detail(int id) //detail { var asset = _asset.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, Type = _asset.GetType(id), Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDirector = _asset.GetAuthorOrDirector(id), CurrentLocation = _asset.GetCurrentLocation(id)?.Name, DeweyCallNumber = _asset.GetDeweyIndex(id), CheckoutHistory = _checkout.GetCheckoutHistories(id), //CurrentAssociatedLibraryCard = _asset.GetLibraryCardByAssetId(id), ISBN = _asset.GetIsbn(id), LatestCheckout = _checkout.GetLatestCheckout(id), CurrentHolds = currentHolds, PatronName = _checkout.GetCurrentHoldCheckoutPatron(id) }; return(View(model)); }
public IActionResult Detail(int id) { var asset = assets.GetById(id); var currentHolds = checkOut.GetCurrentHolds(id) .Select(a => new AssetHoldModel { HoldPlaced = checkOut.GetCurrentHoldPlaced(a.Id), PatronName = checkOut.GetCurrentHoldPatron(a.Id) }); var model = new AssetDetailModel { AssetId = id, Title = asset.Tittle, Type = assets.GetType(id), Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDirector = assets.GetAuthorOrDirector(id), CheckOutHistory = checkOut.GetCheckOutHistory(id), ISBN = assets.GetIsbn(id), LastChechOut = checkOut.GetLatestCheckOut(id), PatronName = checkOut.GetCurrentPatron(id), CurrentHolds = currentHolds }; return(View(model)); }
public IActionResult Detail(int id) { //if (ModelState.IsValid) //{ // LibraryAsset asset = assets.GetById(id); // AssetDetailModel model = new AssetDetailModel() // { // AssetId = id, // Title = asset.Title, // AuthorOrDirector = assets.GetAuthorOrDirection(id), // //Type = assets.GetType(id), // Year = asset.Year, // ISBN = assets.GetIsbn(id), // DeweyCallNumber = assets.GetDeweyIndex(id), // Status = asset.Status.Name, // Cost = asset.Cost, // CurrentLocation = assets.GetCurrentLocation(id).Name, // ImageUrl = asset.ImageUrl // //PatronName = assets. // }; if (ModelState.IsValid) { LibraryAsset asset = assets.GetById(id); IEnumerable <AssetHoldModel> currentHolds = checkout.GetCurrentHolds(id) .Select(a => new AssetHoldModel { HoldIsPlaced = checkout.GetCurrentHoldPlaced(id).ToString("d"), PatronName = checkout.GetCurrentPatronName(id) }); AssetDetailModel 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), CheckoutHistory = checkout.GetCheckoutHistory(id), ISBN = assets.GetIsbn(id), LastestCheckOut = checkout.GetLatestCheckout(id), PatronName = checkout.GetCurrentPatronName(id), AssetHolds = currentHolds }; return(View(model)); } return(View("Error")); // return View(model); // } // return View("Error"); }
public IActionResult Detail(int id) { int libraryCardId; var asset = _assets.GetById(id); var currentHolds = _checkouts.GetCurrentHolds(id) .Select(p => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(p.Id).ToString("d"), PatronName = _checkouts.GetCurrentHoldPatronName(p.Id) }); var firstHold = _checkouts.GetLastestHold(id); if (firstHold == null) { libraryCardId = 0; } else { libraryCardId = firstHold.LibraryCard.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), CheckoutHistory = _checkouts.GetCheckoutHistories(id), ISBN = _assets.GetIsbn(id), LatestCheckout = _checkouts.GetLastestCheckout(id), PatronName = _checkouts.GetCurrentCheckoutPatron(id), FirstHoldLibraryCardId = libraryCardId, CurrentHolds = currentHolds }; return(View(model)); }
//Returns the details for a selected asset public IActionResult Detail(int id) { //Selects the required asset LibraryAsset 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 currentCheckoutHistory = _checkouts.GetCheckoutHistory(id) .Select(a => new AssetCheckoutHistoryModel { Id = id, PatronName = _checkouts.GetCurrentCheckedOutPatronName(a.Id), CheckedOut = _checkouts.CheckedOut(a.Id), CheckedIn = _checkouts.CheckedIn(a.Id), LibraryCardId = a.LibraryCard.Id }); //Creates the ViewModel //Populate the AssetDetail model with: // LibraryAsset properties OR // services from the _assets ILibrary service AssetDetailModel model = new AssetDetailModel() { AssetId = id, Title = asset.Title, Year = asset.Year, Status = asset.Status.Name, Cost = asset.Cost, ImageUrl = asset.ImageUrl, AuthorOrDirector = _assets.GetAuthorOrDirector(id), CurrentLocation = _assets.GetCurrentLocation(id).Name, Type = _assets.GetType(id), DeweyCallNumber = _assets.GetDeweyIndex(id), ISBN = _assets.GetIsbn(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), LatestCheckOut = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentCheckoutPatron(id), CurrentHolds = currentHolds, CurrentCheckoutHistory = currentCheckoutHistory }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _assets.Get(id); //var currentHolds = _checkoutsService.GetCurrentHolds(id).Select(a => new AssetHoldModel //{ // HoldPlaced = _checkoutsService.GetCurrentHoldPlaced(a.Id), // PatronName = _checkoutsService.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, // Dewey = _assets.GetDeweyIndex(id), // CheckoutHistory = _assets.GetCheckoutHistory(id), // CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id), // Isbn = _assetsService.GetIsbn(id), // LatestCheckout = _checkoutsService.GetLatestCheckout(id), // CurrentHolds = currentHolds, // PatronName = _checkoutsService.GetCurrentPatron(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) { int libCard = 0; bool isLogin = false; if (HttpContext.Session.GetString("username") != null) { libCard = (int)HttpContext.Session.GetInt32("LibraryCard"); isLogin = true; } var asset = _assets.GetById(id); var currentHolds = _checkouts.GetCurrentHold(id) .Select(a => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(a.Id).ToString(), 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), //Ham duoc viet cho lop Interface - Services CurrentLocation = _assets.GetCurrentLocation(id)?.Name, Dewey = _assets.GetDeweyIndex(id), Isbn = _assets.GetIsbn(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), CurrentAssociatedLibraryCard = _assets.GetLibraryCardByAssetId(id), LatestCheckout = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentPatron(id), CheckHoldExist = _checkouts.CheckHoldExist(id, libCard), CurrentHolds = currentHolds, IsLogin = isLogin }; string msg = ""; msg += _checkouts.CheckHoldExist(id, libCard); return(View(model)); //msg += libCard; //return Content(msg); }
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)); }
// GET: Catalog/Details/5 public ActionResult Details(int id) { var asset = _asset.GetById(id); var currentHolds = _checkout.GetCurrentHolds(id) .Select(a => new AssetHoldModel() { Patron = _checkout.GetCurrentHoldPatron(a.Id), HolDateTime = _checkout.GetCurrentHoldPlacedTime(a.Id) }); var model = new LibraryAssetDetailsDTO { Id = id, Title = asset.Title, Year = asset.Year, Cost = asset.Cost, AuthorOrDirector = _asset.GetAuthorOrDirector(id), ImageUrl = asset.ImageUrl, ISBN = _asset.GetIsbn(id), CurrentLocation = _asset.GetCurrentLibraryBranch(id).Name, Status = asset.Status.Name, NumberOfCopies = asset.NumberOfCopies, Type = _asset.GetType(id), Patron = _checkout.GetCurrentCheckoutPatron(id), CheckoutHistories = _checkout.GetCheckoutHistories(id), LatestCheckout = _checkout.GetLatestCheckout(id), CurrentHolds = currentHolds }; //var model=new LibraryAssetDetailsApi //{ // LibraryAssetDetails = model //}; return(View(model)); }