public IActionResult Index() { var branches = _branch.GetAll().Select(b => new BranchDetailModel { Id = b.Id, Name = b.Name, IsOpen = _branch.IsbranchOpen(b.Id), NumberOfAssets = _branch.GetAssets(b.Id).Count(), NumberOfPatrons = _branch.GetPatrons(b.Id).Count() }); var model = new BranchIndexModel() { Branches = branches }; return(View(model)); }