コード例 #1
0
        public IActionResult EditInfo(int id)
        {
            var list = _branch.GetAll();
            IEnumerable <BranchDetailModel> ResultBranch = list.
                                                           Select(result => new BranchDetailModel
            {
                Id   = result.Id,
                Name = result.Name,
            });
            List <BranchDetailModel> listBranch = ResultBranch.ToList();
            SelectList branchList = new SelectList(listBranch, "Id", "Name");

            ViewBag.branchList = branchList;

            var patron = _patronService.Get(id);
            var model  = new PatronDetailModel
            {
                Id            = id,
                FirstName     = patron.FirstName,
                LastName      = patron.LastName,
                Address       = patron.Address,
                Telephone     = patron.TelephoneNumber,
                LibraryCardId = patron.LibraryCardId,
                Email         = patron.Email,
                DateOfBirth   = patron.DateOfBirth
            };

            return(View(model));
        }
コード例 #2
0
ファイル: BranchController.cs プロジェクト: mnngocc/Library
        public IActionResult Index()
        {
            if (HttpContext.Session.GetString("username") == null)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else if (HttpContext.Session.GetInt32("role_id") == 3)
            {
                return(RedirectToAction("Login", "Home"));
            }
            else
            {
                var branchModels = _branchService.GetAll()
                                   .Select(br => new BranchDetailModel
                {
                    Id              = br.Id,
                    BranchName      = br.Name,
                    NumberOfAssets  = _branchService.GetAssetCount(br.Id),
                    NumberOfPatrons = _branchService.GetPatronCount(br.Id),
                    IsOpen          = _branchService.IsBranchOpen(br.Id)
                }).ToList();

                var model = new BranchIndexModel
                {
                    Branches = branchModels
                };

                return(View(model));
            }
        }
コード例 #3
0
ファイル: AssetsController.cs プロジェクト: mnngocc/Library
        public IActionResult AddBook()
        {
            string mess = "";
            var    list = _branch.GetAll();
            IEnumerable <BranchDetailModel> ResultBranch = list.
                                                           Select(result => new BranchDetailModel
            {
                Id   = result.Id,
                Name = result.Name,
            });
            List <BranchDetailModel> listBranch = ResultBranch.ToList();
            SelectList branchList = new SelectList(listBranch, "Id", "Name");

            ViewBag.branchList = branchList;
            mess += branchList.ToArray().Length;
            // return Content(mess);
            return(View());
        }
コード例 #4
0
        public IActionResult Index()
        {
            var model = _branchService.GetAll()
                        .Select(br => new BranchDetailModel
            {
                Id              = br.Id,
                BranchName      = br.Name,
                Address         = br.Address,
                NumberOfAssets  = _branchService.GetAssetCount(br.Id),
                NumberOfPatrons = _branchService.GetPatronCount(br.Id)
            }).ToList();

            return(View(model));
        }
コード例 #5
0
        public IActionResult Index()
        {
            var branchModels = _branchService.GetAll()
                               .Select(br => new BranchDetailModel
            {
                Id              = br.Id,
                BranchName      = br.Name,
                NumberOfAssets  = _branchService.GetAssetCount(br.Id),
                NumberOfPatrons = _branchService.GetPatronCount(br.Id),
                IsOpen          = _branchService.IsBranchOpen(br.Id)
            }).ToList();

            var model = new BranchIndexModel
            {
                Branches = branchModels
            };

            return(View(model));
        }
コード例 #6
0
ファイル: HomeController.cs プロジェクト: mnngocc/Library
        public IActionResult Index()
        {
            var totalAssets = _branch.TotalAssets();
            var branch      = _branch.GetAll();
            var List        = branch
                              .Select(result => new BranchDetailModel
            {
                Id          = result.Id,
                ImageURL    = result.ImageUrl,
                Name        = result.Name,
                Address     = result.Address,
                Telephone   = result.Telephone,
                Description = result.Description,
                OpenDate    = result.OpenDate
            });
            var model_branch = new BranchIndexModel()
            {
                Branches    = List,
                TotalAssets = totalAssets,
                TotalPatron = _branch.TotalPatrons()
            };

            return(View(model_branch));
        }
コード例 #7
0
        public IActionResult ListBranch()
        {
            var branch = _branch.GetAll();
            var List   = branch
                         .Select(result => new BranchDetailModel
            {
                Id              = result.Id,
                ImageURL        = result.ImageUrl,
                Name            = result.Name,
                Address         = result.Address,
                Telephone       = result.Telephone,
                Description     = result.Description,
                OpenDate        = result.OpenDate,
                NumberOfAssets  = _branch.GetAssetCount(result.Id),
                NumberOfPatrons = _branch.GetPatronCount(result.Id),
                IsOpen          = _branch.IsBranchOpen(result.Id)
            });
            var model_branch = new BranchIndexModel()
            {
                Branches = List
            };

            return(View(model_branch));
        }