Пример #1
0
        public IActionResult Detail(int id)  // localhost:#####/Asset/Detail/123    controller/Action/Id#
        {
            var asset = _assets.GetById(id); // returns asset from database by id

            var model = new AssetDetailModel
            {
                AssetId          = id,
                Title            = asset.Title,
                Year             = asset.Year,
                Cost             = asset.Cost,
                ImageUrl         = "/images/" + asset.ImageUrl,
                AuthorOrDirector = _assets.GetAuthorOrDirector(id), // use Asset Service to get AuthorOrDirector
                DeweyCallNumber  = _assets.GetDeweyIndex(id),       // use Asset Service to get GetDeweyIndex
                ISBN             = _assets.GetIsbn(id),             // use Asset Service to get ISBN
                CurrentLocation  = _assets.GetCurrentLocation(id).Name
            };

            return(View(model));
        }