Beispiel #1
0
        public IActionResult Index()
        {
            var allBranches = _branch
                              .GetAllBranches()
                              .Select(branch => new LibraryBranchDetailModel
            {
                Id              = branch.Id,
                Name            = branch.Name,
                isOpen          = _branch.IsBranchOpen(branch.Id),
                NumberOfAssets  = _branch.GetAllAssets(branch.Id).Count(),
                NumberOfPatrons = _branch.GetAllPatrons(branch.Id).Count(),
                Address         = branch.Address,
                Telephone       = branch.Telephone
            });

            var model = new LibraryBranchIndexModel()
            {
                Branches = allBranches
            };

            return(View(model));
        }
Beispiel #2
0
        public IActionResult Index()
        {
            var Tempmodel = _branch.GetAll().Select(p => new BranchDetailModel
            {
                Id                     = p.Id,
                Name                   = p.Name,
                Address                = p.Address,
                Telephone              = p.Telephone,
                Description            = p.Description,
                OpenDate               = p.OpenDate.ToString("yyyyy'-'MM"),
                NumberOfUser           = _branch.GetAllUsers(p.Id).Count(),
                TotalLibraryAssetCount = _branch.GetAllAssets(p.Id).Count(),
                ImageUrl               = "",
                IsOpen                 = _branch.IsOpen(p.Id),
                HoursOpen              = _branch.GetHours(p.Id)
            });
            var model = new BranchIndexModel
            {
                Branches = Tempmodel
            };

            return(View(model));
        }