public IActionResult Detail(int id)
        {
            var branch = _branch.Get(id);

            var model = new BranchDetailModel
            {
                Id              = branch.Id,
                Name            = branch.Name,
                Address         = branch.Address,
                Telephone       = branch.Telephone,
                OpenDate        = branch.OpenDate.ToString("dd/MM/yyyy"),
                NumberOfAssets  = _branch.GetAssets(branch.Id).Count(),
                NumberOfPatrons = _branch.GetPatrons(branch.Id).Count(),
                TotalAssetValue = _branch.GetAssets(id).Sum(a => a.Cost),
                ImageUrl        = branch.ImageUrl,
                HoursOpen       = _branch.GetBranchHours(id),
                IsOpen          = _branch.IsBranchOpen(branch.Id)
            };

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

            //Retrun the DetailModel
            var model = new BranchDetailModel
            {
                Id               = branch.Id,
                BranchName       = branch.Name,
                Address          = branch.Address,
                Telephone        = branch.Telephone,
                BranchOpenedDate = branch.OpenDate.ToString("yyy-MM-dd"),
                NumberOfAssets   = _branch.GetAssets(id).Count(),
                NumberOfPatrons  = _branch.GetPatrons(id).Count(),
                TotalAssetValue  = _branch.GetAssets(id).Sum(a => a.Cost),
                ImageUrl         = branch.ImageUrl,
                HoursOpen        = _branch.GetBranchHours(id)
            };

            return(View(model));
        }
        public IActionResult Detail(int Id)
        {
            var a = _branch.GetById(Id);

            var model = new BranchDetailModel
            {
                Id              = a.Id,
                BranchName      = a.Name,
                Address         = a.Address,
                TelephoneNumber = a.Telephone,
                Description     = a.Description,
                isOpen          = _branch.isBranchOpen(a.Id),
                NumberOfAssets  = _branch.GetLibraryAssets(a.Id).Count(),
                NumberOfPatrons = _branch.GetPatrons(a.Id).Count(),
                ImgUrl          = a.ImageUrl,
                OpenDate        = a.OpenDate.ToString("yyyy-MM-dd"),
                TotalAssetValue = _branch.GetLibraryAssets(Id).Sum(c => c.Cost),
                HoursOpen       = _branch.GetBranchHours(a.Id)
            };

            return(View(model));
        }