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() }); return(View(branches)); }
public IActionResult Index() { var branches = _branch.GetAll() .Select(b => new BranchDetailModel(b) { NumberOfAssets = _branch.GetAssets(b.Id).Count(), NumberOfPatrons = _branch.GetPatrons(b.Id).Count(), //////////////IsOpen = _branch.IsBranchOpen(b.Id), }); BranchIndexModel model = new BranchIndexModel() { Branches = branches }; return(View(model)); }
public IActionResult Index() { var branches = _branch.GetAll().Select(branch => new BranchDetailModel { Id = branch.Id, Name = branch.Name, IsOpen = _branch.IsBranchOpen(branch.Id), NumberOfAssets = _branch.GetAssets(branch.Id).Count(), NumberOfPattorns = _branch.GetPatrons(branch.Id).Count() }); var model = new BranchIndexModel() { Braches = branches }; return(View(model)); }
public IActionResult Index() { var branches = _branch.GetAll().Select(b => new BranchDetailModel { Id = b.Id, Name = b.Name, IsOpen = _branch.IsBranchOpen(b.Id), //if we have alot asset and patron we should seperate query for more efficent NumberOfAssets = _branch.GetAssets(b.Id).Count(), NumberOfPatrons = _branch.GetPatrons(b.Id).Count() }); var model = new BranchIndexModel() { Branches = branches }; return(View(model)); }
public IEnumerable <BranchDetailModel> Get() { var branches = _branch.GetAll().Select(branch => new BranchDetailModel { Id = branch.Id, Name = branch.Name, IsOpen = _branch.IsBranchOpen(branch.Id), NumberOfAssets = _branch.GetAssets(branch.Id).Count(), NumberOfPatrons = _branch.GetPatrons(branch.Id).Count(), PhoneNo = branch.Telephone }); var model = new BranchIndexModel() { Branches = branches }; return(model.Branches); }
public IActionResult Index() { var branchModels = _branch.GetAll() .Select(br => new BranchDetailModel { Id = br.Id, BranchName = br.Name, NumberOfAssets = _branch.GetAssets(br.Id).Count(), NumberOfPatrons = _branch.GetPatrons(br.Id).Count(), IsOpen = _branch.IsBranchOpen(br.Id) }).ToList(); var model = new BranchIndexModel { Branches = branchModels }; return View(model); }
public IEnumerable <BranchDetailModel> GetLibraryBranches() { var branches = _branch.GetAll().Select(b => new BranchDetailModel { Id = b.Id, BranchName = b.Name, IsOpen = _branch.IsBranchOpen(b.Id), NumberOfAssets = _branch.GetAssets(b.Id).Count(), NumberOfPatrons = _branch.GetPatrons(b.Id).Count(), });; return(branches); }
public IActionResult Index() { var branches = _branch.GetAll().Select(branch => new BranchDeatailModel { Id = branch.ID, Address = branch.Address, Description = branch.Description, ImageUrl = branch.ImageUrl, Name = branch.Name, NOOfAssets = _branch.GetAssets(branch.ID).Count(), NOOfPatrons = _branch.Getpatrons(branch.ID).Count(), IsOpen = _branch.IsBranchOpen(branch.ID), Telephone = branch.Telephone }); var model = new BranchIndexModel { Branches = branches }; return(View(model)); }
public IActionResult Index() { var branchModels = _branch.GetAll().Select(b => new BranchDetailModel { Id = b.Id, Name = b.Name, Address = b.Address, Description = b.Description, ImageUrl = b.ImageUrl, TelephoneNumber = b.Telephone, OpenDate = b.OpenDate.ToString(), IsOpen = _branch.IsBranchOpen(b.Id), OpenHours = _branch.GetBranchHours(b.Id), NumberOfAssets = _branch.GetAssets(b.Id).Count(), NumberOfPatrons = _branch.GetPatrons(b.Id).Count(), TotalAssetValue = _branch.GetAssets(b.Id).Select(a => a.Cost).Sum() }).ToList(); var model = new BranchIndexModel { Branches = branchModels }; return(View(model)); }