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)); }