public IActionResult Index() { var branchModels = branch.GetAll() .Select(br => new BranchDetailModel { Id = br.Id, BranchName = br.Name, NumberOfAssets = branch.GetAssetCount(br.Id), NumberOfPatrons = branch.GetPatronCount(br.Id), IsOpen = branch.IsBranchOpen(br.Id), Description = br.Description, Address = br.Address, Telephone = br.Telephone, BranchOpenedDate = br.OpenDate.ToString("yyyy-MM-dd"), TotalAssetValue = branch.GetAssetsValue(br.Id), ImageUrl = br.ImageUrl, HoursOpen = branch.GetBranchHours(br.Id), }).ToList(); var model = new BranchIndexModel { Branches = branchModels }; return(View(model)); }
public IActionResult Index() { var branches = branch.GetAll().Select(b => new BranchDetailModel { Id = b.Id, BranchName = b.Name, IsOpen = branch.IsBranchOpen(b.Id), NumberOfAssets = branch.GetAssetCount(b.Id), NumberOfPatrons = branch.GetPatronCount(b.Id) }); var model = new BranchIndexModel() { Branches = branches }; return(View(model)); }
public IActionResult Index() { IEnumerable <BranchDetailModel> branches = _branches.GetAll().Select(lb => new BranchDetailModel { Id = lb.Id, BranchName = lb.Name, IsOpen = _branches.IsBranchOpen(lb.Id) ? "Open" : "Closed", NumberOfAssets = _branches.GetAssetCount(lb.Id), NumberOfPatrons = _branches.GetPatronCount(lb.Id) }); BranchIndexModel model = new BranchIndexModel() { Branches = branches }; return(View(model)); }
public IActionResult Index() { var branchModels = _branchSvc.GetAll().Select(br => new BranchDetailModel { Id = br.Id, BranchName = br.Name, NumberOfAssets = _branchSvc.GetAssetCount(br.Id), NumberOfPatrons = _branchSvc.GetPatronCount(br.Id), IsOpen = _branchSvc.IsBranchOpen(br.Id) }).ToList(); var model = new BranchIndexModel() { Branches = branchModels }; return(View(model)); }
public async Task <IActionResult> Index() { var spec = new LibraryBranchesWithPatronAndAssetsSpecification(); var allBranches = await _branch.ListAsync(spec); var branchModels = allBranches .Select(branch => new BranchDetailModel { Id = branch.Id, BranchName = branch.Name, NumberOfAssets = _branch.GetAssetCount(branch.Id), NumberOfPatrons = _branch.GetPatronCount(branch.Id), IsOpen = _branch.IsBranchOpen(branch.Id) }); var model = new BranchIndexModel() { Branches = branchModels }; return(View(model)); }
public IActionResult Index() { var branches = _branch.GetAll().Select(b => new BranchDetailModel { Id = b.Id, Name = b.Name, NumberOfAssets = _branch.GetAssetCount(b.Id), NumberOfPatrons = _branch.GetPatronCount(b.Id), IsOpen = _branch.IsBranchOpen(b.Id), Address = b.Address, OpenDate = b.OpenDate.ToString(), Telephone = b.Telephone, Description = b.Description, ImageUrl = b.ImageUrl }).ToList(); var model = new BranchIndexModel() { Branches = branches }; return(View(model)); }