public ActionResult Detail(int id)
        {
            var asset = _assets.GetById(id);

            var currentHolds = _checkout.GetCurrentHolds(id)
                               .Select(a => new AssetHoldViewModel
            {
                HoldPlaced = _checkout.GetCurrentHoldPlaced(a.Id).ToString("d"),
                PatronName = _checkout.GetCurrentHoldPatronName(a.Id)
            });

            var model = new AssetDetailViewModel
            {
                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),
                CheckoutHistory  = _checkout.GetCheckoutHistory(id),
                LatesCheckout    = _checkout.GetLatestCheckout(id),
                PatronName       = _checkout.GetCurrenCheckoutPatron(id),
                CurrentHold      = 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));
        }
Ejemplo n.º 3
0
        public static async Task<AssetDetailViewModel> ToViewModelAsync(this IAsset model)
        {
            if (model == null) return null;

            var viewModel = new AssetDetailViewModel();
            await model.ExtrudeDetailInfo(viewModel);
            return viewModel;
        }
Ejemplo n.º 4
0
 private static async Task ExtrudeDetailInfo(this IAsset model, AssetDetailViewModel viewModel)
 {
     viewModel.Id = model.Id;
     viewModel.Url = model.Url;
     viewModel.Container = model.Container;
     viewModel.Owner = model.Owner;
     viewModel.Title = model.Title;
     viewModel.Type = model.Type.ToTypeString();
 }
Ejemplo n.º 5
0
        public AssetDetailPage()
        {
            InitializeComponent();

            var asset = new Asset
            {
                Name  = "Item 1",
                Notes = "This is an item description."
            };

            viewModel      = new AssetDetailViewModel(asset);
            BindingContext = viewModel;
        }
Ejemplo n.º 6
0
        // 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));
        }
Ejemplo n.º 7
0
        public AssetDetail(Asset model)
        {
            InitializeComponent();
            vm          = new AssetDetailViewModel();
            vm.myAsset  = model;
            DataContext = vm;

            Searchbox_AssignedTo.SetType(typeof(User));
            if (vm.myAsset.AssignedToUser != null)
            {
                Searchbox_AssignedTo.SetCurrentSelectedObject(vm.myAsset.AssignedToUser.ID);
            }
            Searchbox_AssignedTo.PropertyChanged += (s, e) => { vm.OnAssignedUserChange(Searchbox_AssignedTo.CurrentSelection.ID); };

            Searchbox_Phase.SetType(typeof(Phase));
            if (vm.myAsset.Phase != null)
            {
                Searchbox_Phase.SetCurrentSelectedObject(vm.myAsset.Phase.ID);
            }
            Searchbox_Phase.PropertyChanged += (s, e) => { vm.OnPhaseChanged(Searchbox_Phase.CurrentSelection.ID); };

            InitializeTimeline();
        }
Ejemplo n.º 8
0
        public AssetDetailPage(AssetDetailViewModel viewModel)
        {
            InitializeComponent();

            BindingContext = this.viewModel = viewModel;
        }
Ejemplo n.º 9
0
 public async Task<ActionResult> Index(AssetDetailViewModel model, HttpPostedFileBase file)
 {
     return await ProcessResult(() => AssetsLibrary.CreateAsset(model.Container, model.Type, model.Owner, file.FileName, file.InputStream));
 }