public ActionResult Index(string searchString, int?FacultyID, int?DepartmentID) { var singleSelectList = new SelectedDetailsModel(); singleSelectList.Faculty = _context.Faculty.ToList(); if (FacultyID == null) { byte[] kkk = HttpContext.Session.Get("FacultyID"); if (kkk != null) { string someString = Encoding.ASCII.GetString(kkk); FacultyID = Convert.ToInt32(someString); } } if (FacultyID != null) { HttpContext.Session.SetString("FacultyID", FacultyID.ToString()); singleSelectList.Department = _context.Department.Where(w => w.FacultyID == FacultyID.Value).ToList(); } if (DepartmentID != null) { singleSelectList.Book = _context.Book.Include(i => i.BookTypes).Include(a => a.Author).Include(p => p.Publisher).Where(w => w.DepartmentID == DepartmentID.Value).ToList(); } return(View(singleSelectList)); }
// GET: Details public ActionResult Index(int?FacultyID, int?DepartmentID) { var singleSelectList = new SelectedDetailsModel(); singleSelectList.Faculties = db.Faculties.ToList(); if (FacultyID == null) { if (Session["FacultyID"] != null) { FacultyID = Convert.ToInt32(Session["FacultyID"].ToString()); } } if (FacultyID != null) { Session["FacultyID"] = FacultyID; singleSelectList.Departments = db.Departments.Where(w => w.FacultyID == FacultyID.Value).ToList(); } if (DepartmentID != null) { singleSelectList.Books = db.Books.Where(w => w.DepartmentID == DepartmentID.Value).ToList(); } return(View(singleSelectList)); }
// GET: Details public IActionResult Index(string searchString, int?DepartmentID, int?EmployeeID) { var singleSelectList = new SelectedDetailsModel(); singleSelectList.Department = _context.Department.ToList(); if (DepartmentID == null) { byte[] kkk = HttpContext.Session.Get("DepartmentID"); if (kkk != null) { string someString = Encoding.ASCII.GetString(kkk); DepartmentID = Convert.ToInt32(someString); } } if (DepartmentID != null) { HttpContext.Session.SetString("DepartmentID", DepartmentID.ToString()); singleSelectList.Employee = _context.Employee.Include(i => i.Job).Where(w => w.DepartmentID == DepartmentID.Value).ToList(); } if (EmployeeID != null) { singleSelectList.EmploymentHistory = _context.EmploymentHistory.Include(e => e.Institute).Include(e => e.Company).Include(w => w.Certificate).Where(w => w.EmployeeID == EmployeeID.Value).ToList(); } return(View(singleSelectList)); }