public IActionResult Detail(int id) { var asset = _assets.GetById(id); var trenutneRezervacije = _iznajmljivanje.GetCurrentRezervacije(id) .Select(a => new AssetRezervacijaModel { Rezervisano = _iznajmljivanje.GetCurrentRezervacija(a.Id).ToString("d"), ImeClana = _iznajmljivanje.GetCurrentClanName(a.Id) }); var model = new AssetDetailModel() { AssetId = id, Naziv = asset.Naziv, GlavniGlumci = _assets.GetGlavniGlumci(id), TrenutnaLokacija = _assets.GetCurrentOgranak(id).Naziv, DatumIzlaska = asset.DatumIzlaska, ImgUrl = asset.ImgUrl, Status = asset.Status.Naziv, Cena = asset.Cena.ToString(), Producent = _assets.GetProducent(id), IstorijaIznajmljivanja = _iznajmljivanje.GetIstorijaIznajmljivanja(id), LatestIznajmljivanje = _iznajmljivanje.GetLatestIznajmljivanje(id), ImeClana = _iznajmljivanje.GetCurrentClanIznajmljeno(id), TrenutneRezervacije = trenutneRezervacije, BrojKopija = asset.BrojKopija }; return(View(model)); }
public IActionResult Details(int id) { var asset = _asset.getByID(id); var currentHold = _checkout.getCurrentHold(id) .Select(a => new AssetHoldModel { holdPlaced = _checkout.getCurrentHoldPlaced(a.id), 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, type = _asset.getType(id), author = _asset.getAuthor(id), currentBranch = _asset.getCurrentLocation(id).name, deweyIndex = _asset.getDeweyIndex(id), isbn = _asset.getISBN(id), checkoutHistories = _checkout.getCheckOutHistory(id), latestCheckOut = _checkout.getLatestCheckout(id), patronName = _checkout.getCurrentCheckOutPatronName(id), currentHold = currentHold, }; 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.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 = _assets.GetAuthorOrDirector(id), CurrentLocation = _assets.GetCurrentLocation(id).Name, DeweyCallNumber = _assets.GetDewayIndex(id), CheckoutHistories = _checkout.GetCheckOutHistory(id), ISBN = _assets.GetIsbn(id), LatestCheckout = _checkout.GetLatestCheckout(id), PatronName = _checkout.GetCurrentCheckoutPatron(id), CurrentHolds = currentHolds }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _assets.Get(id); var currentHolds = _checkouts.GetCurrentHolds(id).Select(a => new AssetHoldModel { HoldPlaced = _checkouts.GetCurrentHoldPlaced(id), StudentName = _checkouts.GetCurrentHoldStudent(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 = _assets.GetAuthorOrDirector(id), CurrentLocation = _assets.GetCurrentLocation(id).Name, DeweyIndex = _assets.GetDeweyIndex(id), ISBN = _assets.GetIsbn(id), StudentName = _checkouts.GetCurrentStudent(id), CurrentHolds = currentHolds, CheckoutHistory = _checkouts.GetCheckoutHistory(id) }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _libraryAssetService.GetById(id); var currentHolds = _checkoutService.GetCurrentHolds(id).ToList() .Select(a => new AssetHoldModel { HoldPlaced = _checkoutService.GetCurrentHoldPlaced(a.HoldId).ToString("d"), PatronName = _checkoutService.GetCurrentHoldPatronName(a.HoldId) }); var model = new AssetDetailModel { AssetId = id, Title = asset.Title, Year = asset.Year, Cost = Math.Round(asset.Cost, 2).ToString(), Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDirector = _libraryAssetService.GetAuthorOrDirector(id), CurrentLocation = _libraryAssetService.GetCurrentLocation(id).Name, DeweyCallNumber = _libraryAssetService.GetDeweyIndex(id), ISBN = _libraryAssetService.GetISBN(id), CheckoutHistory = _checkoutService.GetCheckoutHistory(id), LatestCheckout = _checkoutService.GetLatestCheckout(id), PatronName = _checkoutService.GetCurrentCheckoutPatron(id), CurrentHolds = 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 Detail(int id) { var asset = _assetsService.Get(id); var currentHolds = _checkoutsService.GetCurrentHolds(id).Select(a => new AssetHoldModel { HoldPlace = _checkoutsService.GetCurrentHoldPlaced(a.Id), PatronName = _checkoutsService.GetCurrentHoldPatron(a.Id) }); var model = new AssetDetailModel { Id = id, Title = asset.Title, Type = _assetsService.GetType(id), Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDirector = _assetsService.GetAuthorOrDirector(id), CurrentLocation = _assetsService.GetCurrentLocation(id)?.Name, DeweyCallNumber = _assetsService.GetDeweyIndex(id), CheckoutHistory = _checkoutsService.GetCheckoutHistory(id), CurrentAssociatedLibraryCard = _assetsService.GetLibraryCardByAssetId(id), ISBN = _assetsService.GetIsbn(id), LatestCheckout = _checkoutsService.GetLatestCheckout(id), CurrentHolds = currentHolds, PatronName = _checkoutsService.GetCurrentPatron(id) }; return(View(model)); }
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 = _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 = this.libraryAssets.GetById(id); var model = new AssetDetailModel { Id = id, Title = asset.Title, Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDirector = this.libraryAssets.GetAuthorOrDirector(id), CurrentLocation = asset.LibraryBranch.Name, DeweyCallNumber = this.libraryAssets.GetDeweyIndex(id), ISBN = this.libraryAssets.GetIsbn(id), Type = this.libraryAssets.GetType(id), CheckoutHistory = this.checkOuts.GetCheckoutHistory(id), LatestCheckout = this.checkOuts.GetLatestCheckout(id), PatronName = this.checkOuts.GetCurrentCheckoutPatron(id), CurrentHolds = this.checkOuts.GetCurrentHolds(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.GetAsset(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 = _assets.GetType(id), Year = asset.Year, Cost = asset.Cost, Isbn = _assets.GetIsbn(id), Status = asset.Status.Name, ImageUrl = asset.ImageUrl, AuthorOrDirector = _assets.GetAuthorOrDirector(id), CurrentLocation = _assets.GetCurrentLocation(id)?.Name, Dewey = _assets.GetDewyIndex(id), CheckoutHistory = _checkout.GetCheckoutHistories(id), // CurrentAssociatedLibraryCard = _ass, // Isbn = _assets.GetIsbn(id), latestCheckout = _checkout.GetLatestCheckout(id), CurrentHolds = currentHolds, PatronName = _checkout.GetCurrentCheckoutPatron(id) }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _assets.GetById(id); var currentHolds = _rentals.GetCurrentHolds(id) .Select(r => new AssetHoldModel { HoldPlace = _rentals.GetCurrentHoldPlaced(id).ToString("d"), Subscriber = _rentals.GetCurrentHoldSubscriberName(id) }); var model = new AssetDetailModel { AssetId = id, Brand = asset.Brand, Name = asset.Name, Description = asset.Description, Rating = asset.Rating, Price = _assets.GetPrice(id), Stock = _assets.GetStock(id), Available = _assets.GetAvailable(id), ImageUrl = asset.ImageUrl, AltImageUrl1 = asset.AltImgUrl1, AltImageUrl2 = asset.AltImgUrl2, AltImageUrl3 = asset.AltImgUrl3, AltImageUrl4 = asset.AltImgUrl4, AltImageUrl5 = asset.AltImgUrl5, RentalHistory = _rentals.GetRentalHistory(id), LatestRental = _rentals.GetRecentRental(id), CurrentHolds = currentHolds }; 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)); }
public IActionResult Detail(int id) { var assetModels = _assetsService.GetById(id); var model = new AssetDetailModel { AssetId = id, Make = assetModels.Make, Model = assetModels.Model, VIN = assetModels.VIN, ImageUrl = assetModels.ImageUrl, Status = assetModels.Status.Name, Cost = assetModels.Cost, BodyType = _assetsService.GetBodyType(id), Options = _assetsService.GetOptions(id), Passengers = _assetsService.GetPassengers(id), Bags = _assetsService.GetBags(id), CurrentLocation = _assetsService.GetVehicleRentalLocation(id).Name, PatronName = _checkoutService.GetCurrentCheckoutPatron(id), LatestCheckout = _checkoutService.GetLatestCheckout(id), CheckoutHistory = _checkoutService.GetCheckoutHistory(id), HoldHistory = _checkoutService.GetCurrentHolds(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 house = _houseAssets.GetHousesById(id); if (house == null) { return(View()); } var listingResult = house.Counter.Indications .Select(indications => new AssetDetailListingModel() { Id = indications.Id, FullAdress = $"{house.City}, {house.Street}, {house.Number}", Indication = indications.CurrentIndication.ToString(), IndicationDate = indications.FillingTime.ToLongDateString() }); var model = new AssetDetailModel() { FullAdress = $"{house.City}, {house.Street}, {house.Number}", VerificationTimeOver = house.Counter.VerificationTimeOver, FactoryNumder = house.Counter.FactoryNumber, HouseId = house.Id, HouseCity = house.City, HouseNumber = house.Number, HousePlace = house.Street, CurrentDate = DateTime.Now, LastIndication = house.Counter.Indications.Last().CurrentIndication, Asset = listingResult }; 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 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 assetid) { var asset = _asset.GetById(assetid); var currentholds = _checkout.GetCurrentHolds(assetid) .Select(a => new AssetHoldModel { HoldPlaced = _checkout.GetCurrentHoldPlaced(assetid), PatronName = _checkout.GetCurrentHoldPatronName(assetid) }); var model = new AssetDetailModel { Id = assetid, Title = asset.Title, Year = asset.Year, Cost = asset.Cost, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, DeweyCallNamber = _asset.GetDeweyIndex(assetid), AuthorOrDirector = _asset.GetDirectorOrAuthor(assetid), CurrentLocation = _asset.GetCurrentlocation(assetid).Name, PatronName = _checkout.GetCurrentCheckoutPatron(assetid), LatestCheckout = _checkout.GetLatestCheckout(assetid), CheckoutHistory = _checkout.GetCheckOutHistory(assetid), AssetHold = currentholds, ISBN = _asset.GetIsbn(assetid), Type = _asset.GetType(assetid) }; 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) { var tworca = _assets.GetById(id); var galeria = _assets.GetTworcaGallery(tworca); var model = new AssetDetailModel { Tworca = tworca, Zdjecia = galeria }; return(View(model)); }
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, // Dewey = _assets.GetDeweyIndex(id), // Isbn = _assets.GetIsbn(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, Dewey = _assets.GetDeweyIndex(id), CheckoutHistory = _checkouts.GetCheckoutHistory(id), Isbn = _assets.GetIsbn(id), LatestCheckout = _checkouts.GetLatestCheckout(id), PatronName = _checkouts.GetCurrentCheckoutPatron(id), CurrentHolds = currentHolds }; return(View(model)); }
public IActionResult Detail(int id) { var asset = _assetsService.Get(id); var model = new AssetDetailModel { AssetId = id, Title = asset.Title, Type = _assetsService.GetType(id), Status = asset.Status.Name, ImageUrl = asset.ImageUrl, }; 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) { 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)); }
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, Status = asset.Status.Name, ImageUrl = asset.ImageUrl, Author = _assets.GetAuthor(id), CurrentLocation = _assets.GetCurrentLocation(id).Name, ISBN = _assets.GetBookIndex(id), BookIndex = _assets.GetBookIndex(id) }; 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)); }
public IActionResult Detail(int id) { var boardgame = _assets.GetById(id); var played = _assets.isPlayed(id); var plays = _assets.GetAllPlaysWhereIdBoardgame(id); var model = new AssetDetailModel() { Id = boardgame.Id, Name = boardgame.Name, Description = boardgame.Description, Image = boardgame.Image, Rating = boardgame.Rating, IsPlayed = played, Played = plays }; return(View(model)); }