public IActionResult EmployeeList()
        {
            try
            {
                //employee record from multiple table
                var EmpList = from EmployeeDataList in _db.tbl_Employee
                              join DepartmentDataList in _db.tbl_Department
                              on EmployeeDataList.dep_id equals DepartmentDataList.dept_id into Dep
                              from DepartmentDataList in Dep.DefaultIfEmpty()

                              select new Employee
                {
                    emp_id        = EmployeeDataList.emp_id,
                    emp_name      = EmployeeDataList.emp_name,
                    date_of_birth = EmployeeDataList.date_of_birth,
                    date_of_join  = EmployeeDataList.date_of_join,
                    dep_id        = EmployeeDataList.dep_id,
                    Department    = DepartmentDataList == null ? "" : DepartmentDataList.dept_name
                };
                return(View(EmpList));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(View());
            }
        }
Beispiel #2
0
        public IActionResult SList()
        {
            try
            {
                var stdList = from a in _Db.tbl_Student
                              join b in _Db.tbl_Departments
                              on a.DepID equals b.ID
                              into Dep
                              from b in Dep.DefaultIfEmpty()

                              select new Student
                {
                    ID          = a.ID,
                    FirstName   = a.FirstName,
                    LastName    = a.LastName,
                    Mobile      = a.Mobile,
                    Email       = a.Email,
                    Description = a.Description,
                    DepID       = a.DepID,
                    JoinDate    = a.JoinDate,

                    Department = b == null ? "" : b.Department
                };

                return(View(stdList));
            }

            catch (Exception ex)
            {
                return(View());
            }
        }
Beispiel #3
0
        public IActionResult StudentList()
        {
            try
            {
                //var stdlist = _Db.tblStudent.ToList();
                var stdlist = from a in _Db.tblStudent
                              join b in _Db.tblDepartment
                              on a.Department_Name equals b.ID
                              into Dep
                              from b in Dep.DefaultIfEmpty()

                              select new Student
                {
                    ID              = a.ID,
                    Name            = a.Name,
                    Gender          = a.Gender,
                    Age             = a.Age,
                    Department_Name = a.Department_Name,

                    Department = b == null?"":b.DepartmentName
                };

                return(View(stdlist));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Beispiel #4
0
        public IActionResult StudentsList()
        {
            try
            {
                //var stdList = _db.tblStudents.ToList();

                var stdList = from a in _db.tblStudents
                              join b in _db.tblDepartments
                              on a.DepartmentID equals b.ID into Dep
                              from b in Dep.DefaultIfEmpty()

                              select new Students
                {
                    ID           = a.ID,
                    Name         = a.Name,
                    FatherName   = a.FatherName,
                    Email        = a.Email,
                    Mobile       = a.Mobile,
                    Description  = a.Description,
                    DepartmentID = a.DepartmentID,
                    Department   = b == null ? "" : b.Name
                };
                return(View(stdList));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IActionResult Index()
        {
            try
            {
                var stdlist = from a in _Db.tbl_Student
                              join b in _Db.tbl_Department
                              on a.DepId equals b.ID
                              into Dep
                              from b in Dep.DefaultIfEmpty()

                              select new Student
                {
                    ID         = a.ID,
                    Name       = a.Name,
                    Email      = a.Email,
                    CellNo     = a.CellNo,
                    DepId      = a.DepId,
                    Department = b == null ? "" : b.DepartmentName
                };
                return(View(stdlist));
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #6
0
        public IActionResult StudentList()
        {
            try
            {
                //var stdList = _Db.tbl_Students.ToList();

                var stdList = from a in _Db.tbl_Student
                              join b in _Db.tbl_Departments
                              on a.DepID equals b.ID into Dep
                              from b in Dep.DefaultIfEmpty()

                              select new Student
                {
                    ID        = a.ID,
                    FirstName = a.FirstName,
                    LastName  = a.LastName,
                    Address   = a.Address,
                    Email     = a.Email,
                    Phone     = a.Phone,
                    DepID     = a.DepID,

                    Department = b == null ? "" : b.Department
                };

                return(View(stdList));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        public IActionResult StudentList()
        {
            try
            {
                var stdList = from a in _Db.tbl_Student
                              join b in _Db.tbl_Departments
                              on a.DeptID equals b.ID
                              into Dep
                              from b in Dep.DefaultIfEmpty()

                              select new Student
                {
                    ID          = a.ID,
                    Name        = a.Name,
                    fname       = a.fname,
                    Mobile      = a.Mobile,
                    Email       = a.Email,
                    Description = a.Description,
                    DeptID      = a.DeptID,

                    Department = b == null ? "" : b.Department
                };

                return(View(stdList));
            }
            catch (Exception ex)
            {
                throw ex;
                // return View();
            }
        }
        public IActionResult EmployeeList()
        {
            try
            {
                var EmployeeList = from a in _Db.tbl_Employee
                                   join b in _Db.tbl_Department
                                   on a.ID equals b.ID
                                   into Dep
                                   from b in Dep.DefaultIfEmpty()

                                   select new Employee
                {
                    ID           = a.ID,
                    Name         = a.Name,
                    Mobile       = a.Mobile,
                    Email        = a.Email,
                    DepartmentID = a.DepartmentID,
                    Description  = a.Description,
                    Department   = b == null?"":b.Department
                };

                return(View(EmployeeList));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Beispiel #9
0
        public IActionResult StudentList()
        {
            var s = from a in _Db.tbl_Student
                    join b in _Db.tbl_Departments
                    on a.DepId equals b.Id
                    into Dep
                    from b in Dep.DefaultIfEmpty()

                    select new Student
            {
                Id    = a.Id,
                name  = a.name,
                DepId = a.DepId,

                DepName = b == null ? "" : b.name
            };
            var stdList = _Db.tbl_Student;

            return(View(s));
        }