Exemple #1
0
        public IActionResult Detail(int id)
        {
            var branch = _branch.Get(id);
            var model  = new BranchDetailModel
            {
                Id              = branch.Id,
                Name            = branch.Name,
                isOpen          = _branch.IsBranchOpen(branch.Id),
                OpenDate        = branch.OpenDate.ToString("yyyy-MM-dd"),
                NumberOfAssets  = _branch.GetAssets(branch.Id).Count(),
                NumberOfPatrons = _branch.GetPatrons(branch.Id).Count(),
                TotalAssetValue = _branch.GetAssets(id).Sum(a => a.Cost),
                ImageUrl        = branch.ImageUrl,
                Address         = branch.Address,
                Description     = branch.Description,
                Telephone       = branch.Telephone,
                HoursOpen       = _branch.GetBrachHours(id)
            };

            return(View(model));
        }