コード例 #1
0
        public async Task <IActionResult> Index()
        {
            var model = await _grade.GetAll();

            if (model != null)
            {
                return(View(model));
            }
            return(View());
        }
コード例 #2
0
        public async Task <IActionResult> Create()
        {
            var grade = await _grade.GetAll();

            var department = await _department.GetAll();


            var departmentList = department.Select(d => new SelectListItem()
            {
                Value = d.Id.ToString(),
                Text  = d.DeptName + " - " + d.DeptCode
            });

            List <string> tempEmailList = _context.UserProfiles.Select(q => q.Email).ToList();
            var           temp          = _context.Users.Where(u => !tempEmailList.Contains(u.Email));



            ViewBag.users = temp.ToList();
            bool isEmpty = !temp.ToList().Any();

            if (isEmpty)
            {
                Alert("No available User!", NotificationType.warning);
                return(RedirectToAction("Index"));
            }
            ViewBag.department = departmentList;

            ViewBag.grades = _context.Grades.Distinct().ToList();

            //var fac = await _grade.GetAll();
            //var FacList = fac.Select(f => new SelectListItem()
            //{
            //    Value = f.Id.ToString(),
            //    Text = f.GradeName
            //}).Distinct();


            //ViewBag.fac = FacList.Distinct();

            return(View());
        }
コード例 #3
0
        public async Task <IActionResult> Create()
        {
            var gradeName = await _grade.GetAll();

            var gradeListName = gradeName.Select(g => new SelectListItem()
            {
                Value = g.Id.ToString(),
                Text  = g.GradeName
            });

            /* var gradeLevel = await _grade.GetAll();
             * var gradeListLevel = gradeLevel.Select(g => new SelectListItem()
             * {
             *   Value = g.Id.ToString(),
             *   Text = g.Level
             * });
             * var gradeStep = await _grade.GetAll();
             * var gradeListStep = gradeStep.Select(g => new SelectListItem()
             * {
             *   Value = g.Id.ToString(),
             *   Text = g.Step
             * });*/
            var user = await _user.GetAll();

            var userList = user.Select(u => new SelectListItem()
            {
                Value = u.Id.ToString(),
                Text  = u.FirstName
            });

            ViewBag.user      = userList;
            ViewBag.gradeName = gradeListName;
            //  ViewBag.gradeLevel = gradeListLevel;
            //  ViewBag.gradeStep = gradeListStep;

            return(View());
        }
コード例 #4
0
        public async Task <IActionResult> Create()
        {
            var dept = await _dept.GetAll();

            var gradeName = await _grade.GetAll();

            var EmailList = _context.EmpUsers.Select(q => q.Account.Email).ToList();
            var users     = _context.Users.Where(u => !EmailList.Contains(u.Email)).ToList();

            var usersList = users.Select(u => new SelectListItem()
            {
                Value = u.Id.ToString(),
                Text  = u.Email
            });


            var deptList = dept.Select(d => new SelectListItem()
            {
                Value = d.Id.ToString(),
                Text  = d.DeptName
            });
            var gradeList = gradeName.Select(d => new SelectListItem()
            {
                Value = d.Id.ToString(),
                Text  = d.GradeName
            });


            ///dropdown of unregistered users
            /// var EmailList = _context.EmpUsers.Select(q => q.Email).ToList();
            //var temp = _context.Users.Where(u => !EmailList.Contains(u.Email));

            //ViewBag.emails = temp.ToList();

            ViewBag.grade = gradeList;
            ViewBag.state = _context.States.ToList();
            ViewBag.dept  = deptList;
            ViewBag.users = usersList;


            return(View());
        }
コード例 #5
0
 public async Task <IActionResult> GetGrades()
 {
     return(Ok(await _grade.GetAll()));
 }
コード例 #6
0
        public async Task <IActionResult> Index()
        {
            /* var grade = await _grade.GetAll();
             * var gradeList = grade.Select(a => new SelectListItem()
             * {
             *   Value = a.Id.ToString(),
             *   Text = a.Level.ToString()
             * });
             */
            var gradeName = await _grade.GetAll();

            var gradeListName = gradeName.Select(g => new SelectListItem()
            {
                Value = g.Id.ToString(),
                Text  = g.GradeName
            });
            var gradeLevel = await _grade.GetAll();

            var gradeListLevel = gradeLevel.Select(g => new SelectListItem()
            {
                Value = g.Id.ToString(),
                Text  = g.Level.ToString()
            });
            var gradeStep = await _grade.GetAll();

            var gradeListStep = gradeStep.Select(g => new SelectListItem()
            {
                Value = g.Id.ToString(),
                Text  = g.Step.ToString()
            });

            ViewBag.gradeName  = gradeListName;
            ViewBag.gradeLevel = gradeListLevel;
            ViewBag.gradeStep  = gradeListStep;


            var fac = await _faculty.GetAll();

            var FacList = fac.Select(f => new SelectListItem()
            {
                Value = f.Id.ToString(),
                Text  = f.Name
            });


            ViewBag.fac = FacList;

            var dept = await _dept.GetAll();

            var deptList = dept.Select(g => new SelectListItem()
            {
                Value = g.Id.ToString(),
                Text  = g.DeptName
            });

            ViewBag.dept = deptList;
            //ViewBag.faculty = facultyList;
            //ViewBag.grade = gradeList;

            return(View(new Salary()));
        }