Beispiel #1
0
        public IActionResult Index()
        {
            var branches = _branch.GetAll().Select(branch => new BranchDetailModel
            {
                Id              = branch.Id,
                Address         = branch.Address,
                Description     = branch.Description,
                HoursOpen       = _branch.GetBranchHours(branch.Id),
                ImageUrl        = branch.ImageUrl,
                IsOpen          = _branch.IsBranchOpen(branch.Id),
                Name            = branch.Name,
                NumberOfAssets  = branch.LibraryAssets.Count(),
                NumberOfPatrons = branch.Patrons.Count(),
                OpenDate        = branch.OpenDate.ToString("yyyy-MM-dd"),
                Telephone       = branch.Telephone,
                TotalAssetValue = branch.LibraryAssets.Sum(asset => asset.Cost)
            });

            var model = new BranchIndexModel
            {
                Branches = branches
            };

            return(View(model));
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        public IActionResult Register()
        {
            //Patron Library dropdown Info

            List <LibraryBranch> libraryList = new List <LibraryBranch>();

            libraryList            = libraryBranch.GetAll().ToList();
            ViewBag.listOfBranches = libraryList;

            //end of library info

            return(View());
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        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 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);
        }
Beispiel #8
0
        public IActionResult Index()
        {
            var branches = _branch.GetAll().Select(x => new BranchDetailViewModel()
            {
                Id     = x.Id,
                Name   = x.Name,
                IsOpen = _branch.IsBranchOpen(x.Id),
                //Asynchronous operations used in a blocking manner below
                NumberOfAssets  = _branch.GetAssetsAsync(x.Id).Result.Count(),
                NumberOfPatrons = _branch.GetPatronsAsync(x.Id).Result.Count()
            });

            var model = new BranchIndexViewModel()
            {
                Branches = branches
            };

            return(View(model));
        }
Beispiel #9
0
        public IActionResult Index()
        {
            var branchModels = _ILibraryBranches.GetAll();

            var listingResults = branchModels.Select(result => new BranchesIndexListingModel()
            {
                Id                  = result.Id,
                Name                = result.Name,
                Address             = result.Address,
                ImageUrl            = result.ImageURL,
                OpeningClosingHours = result.OpenDate
            });

            var model = new BranchIndexModel()
            {
                Branches = listingResults
            };

            return(View(model));
        }
Beispiel #10
0
        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));
        }
Beispiel #11
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));
        }
Beispiel #12
0
        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));
        }
        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));
        }