예제 #1
0
        public StudentViewModel GetStudentbyId(int studentid)
        {
            var result = (from student in _context.Student
                          join user in _context.Users on student.UserID equals user.UserId
                          join department in _context.Department on student.DepartmentID equals department.DepartmentId
                          where student.StudentID == studentid

                          select new StudentViewModel
            {
                StudentId = student.StudentID,
                Cgpa = student.Cgpa,
                Semester = student.Semester,
                UserId = user.UserId,
                UserName = user.UserName,
                FullName = user.FullName,
                EmailId = user.EmailId,
                Contactno = user.Contactno,
                Status = user.Status,
                Password = EncodingLib.DecryptText(user.Password),
                DepartmentId = department.DepartmentId,
                DepartmentName = department.DepartmentName
            }).FirstOrDefault();

            return(result);
        }
예제 #2
0
        public List <StudentViewModel> GetAllStudent(int userId)
        {
            var findUser = (from coordinator in _context.Coordinator
                            join user in _context.Users on coordinator.UserId equals user.UserId
                            where user.UserId == userId
                            select coordinator.CoordinatorId).FirstOrDefault();
            int coorId = Convert.ToInt32(findUser);

            var result = (from student in _context.Student
                          join user in _context.Users on student.UserID equals user.UserId
                          join department in _context.Department on student.DepartmentID equals department.DepartmentId
                          where student.CreatedBy == coorId
                          select new StudentViewModel
            {
                StudentId = student.StudentID,
                Cgpa = student.Cgpa,
                Semester = student.Semester,
                UserId = user.UserId,
                UserName = user.UserName,
                FullName = user.FullName,
                EmailId = user.EmailId,
                Contactno = user.Contactno,
                Status = user.Status,
                Password = EncodingLib.DecryptText(user.Password),
                DepartmentId = department.DepartmentId,
                DepartmentName = department.DepartmentName
            }
                          ).ToList();

            return(result);
        }
        public List <CoordinatorViewModel> GetAllCoordinator()
        {
            var result = (from coordinator in _context.Coordinator
                          join user in _context.Users on coordinator.UserId equals user.UserId
                          join department in _context.Department on coordinator.DepartmentId equals department.DepartmentId
                          select new CoordinatorViewModel
            {
                CoordinatorId = coordinator.CoordinatorId,
                UserId = user.UserId,
                UserName = user.UserName,
                FullName = user.FullName,
                EmailId = user.EmailId,
                Contactno = user.Contactno,
                Status = user.Status,
                Password = EncodingLib.DecryptText(user.Password),
                DepartmentId = department.DepartmentId,
                DepartmentName = department.DepartmentName
            }
                          ).ToList();

            return(result);
        }
        public CoordinatorViewModel GetCoordinatorbyId(int coordinatorId)
        {
            var result = (from coordinator in _context.Coordinator
                          join user in _context.Users on coordinator.UserId equals user.UserId
                          join department in _context.Department on coordinator.DepartmentId equals department.DepartmentId
                          where coordinator.CoordinatorId == coordinatorId

                          select new CoordinatorViewModel
            {
                CoordinatorId = coordinator.CoordinatorId,
                UserId = user.UserId,
                UserName = user.UserName,
                FullName = user.FullName,
                EmailId = user.EmailId,
                Contactno = user.Contactno,
                Status = user.Status,
                Password = EncodingLib.DecryptText(user.Password),
                DepartmentId = department.DepartmentId,
                DepartmentName = department.DepartmentName
            }).FirstOrDefault();

            return(result);
        }
예제 #5
0
        public TeacherViewModel GetTeacherbyId(int teacherid)
        {
            var result = (from teacher in _context.Teacher
                          join user in _context.Users on teacher.UserID equals user.UserId
                          join department in _context.Department on teacher.DepartmentId equals department.DepartmentId
                          where teacher.TeacherID == teacherid

                          select new TeacherViewModel
            {
                TeacherId = teacher.TeacherID,
                UserId = user.UserId,
                UserName = user.UserName,
                FullName = user.FullName,
                EmailId = user.EmailId,
                Contactno = user.Contactno,
                Status = user.Status,
                Password = EncodingLib.DecryptText(user.Password),
                DepartmentId = department.DepartmentId,
                DepartmentName = department.DepartmentName
            }).FirstOrDefault();

            return(result);
        }
예제 #6
0
        public List <TeacherViewModel> GetAllTeachersOfCoordinator(int id)
        {
            var result = (from teacher in _context.Teacher
                          join user in _context.Users on teacher.UserID equals user.UserId
                          join department in _context.Department on teacher.DepartmentId equals department.DepartmentId
                          where teacher.CreatedBy == id
                          select new TeacherViewModel
            {
                TeacherId = teacher.TeacherID,
                UserId = user.UserId,
                UserName = user.UserName,
                FullName = user.FullName,
                EmailId = user.EmailId,
                Contactno = user.Contactno,
                Status = user.Status,
                Password = EncodingLib.DecryptText(user.Password),
                DepartmentId = department.DepartmentId,
                DepartmentName = department.DepartmentName
            }
                          ).ToList();

            return(result);
        }