public IActionResult LibraryBranchDetails(int id)
        {
            var branch = _branch.get(id);
            var model  = new LibraryBranchDetailModel
            {
                branchId        = branch.id,
                branchName      = branch.name,
                address         = branch.address,
                description     = branch.description,
                branchPhone     = branch.telephone,
                openDate        = branch.openDate.ToString("yyyy-MM-dd"),
                numberOfAsset   = _branch.getAsset(branch.id).Count(),
                numberOfPatron  = _branch.getPatrons(branch.id).Count(),
                totalAssetValue = _branch.getAsset(branch.id).Sum(a => a.cost),
                imageUrl        = branch.imageUrl,
                hourOpen        = _branch.getBranchHour(id),
            };

            return(View(model));
        }
예제 #2
0
        public IActionResult Detail(int id)
        {
            var branch = _branch.Get(id);

            var model = new LibraryBranchDetailModel()
            {
                Id              = branch.Id,
                Name            = branch.Name,
                Address         = branch.Address,
                Telephone       = branch.Telephone,
                OpenDate        = branch.OpenDate.ToString("dd-MM-yyyy"),
                NumberOfAssets  = _branch.GetAllAssets(id).Count(),
                NumberOfPatrons = _branch.GetAllPatrons(id).Count(),
                TotlaAssetValue = _branch.GetAllAssets(id).Sum(asset => asset.Cost),
                ImageUrl        = branch.ImageUrl,
                BranchHours     = _branch.GetBranchHours(id)
            };

            return(View(model));
        }