Esempio n. 1
0
 public BranchDetailModel(Models.LibraryBranch branch)
 {
     Id        = branch.Id;
     Name      = branch.Name;
     Address   = branch.Address;
     Telephone = branch.Telephone;
     OpenDate  = branch.OpenDate.ToString("yyyy-MM-dd");
     ImageUrl  = branch.ImageUrl;
 }
Esempio n. 2
0
        public IActionResult Detail(int id)
        {
            Models.LibraryBranch branch = _branch.GetById(id);//.LibraryBranches.ToList();
            if (branch == null)
            {
                return(RedirectToAction("Index"));
            }
            BranchDetailModel model = new BranchDetailModel(branch)
            {
                NumberOfAssets  = _branch.GetAssets(branch.Id).Count(),
                NumberOfPatrons = _branch.GetPatrons(branch.Id).Count(),
                TotalAssetValue = _branch.GetAssets(branch.Id).Sum(c => c.Cost),
                HoursOpen       = _branch.GetBranchHours(branch.Id),
            };

            return(View(model));
        }