public ActionResult Index() { List <StudentListModel> studentListModel = _studentBLL.GetAll() .Select(x => new StudentListModel() { Id = x.Id, FirstName = x.FirstName, LastName = x.LastName, GenderName = x.Gender.Name, EducationBranchName = x.EducationBranch.Name, DateOfBirth = x.DateOfBirth, DateOfRegistration = x.DateOfRegistration, IsOnline = x.IsOnline, Status = x.Status }).ToList(); return(View(studentListModel)); }
public ActionResult Edit(int id = 0) { EducationGroup educationGroup; List <Student> allStudent = _stuBLL.GetAll(); ViewBag.StudentList = new MultiSelectList((from s in _stuBLL.GetAll() select new { ID = s.Id, FullName = s.FirstName + " " + s.LastName }), "ID", "FullName", null); List <Gender> allGender = _stuBLL.GenderList(); SelectList genderSelectList = new SelectList(allGender, "Id", "Name"); ViewBag.GenderList = genderSelectList; List <EducationGroupListModel> educationGroupListModel = _educationGroupBLL.TrainerEducationGroup((int)Session["LoginID"]) .Select(x => new EducationGroupListModel() { Id = x.Id, Name = x.Name, DateOfCrecation = x.DateOfCreation, DateOfEnd = x.DateOfEnd, TrainerFirstName = x.Trainer.FirstName, TrainerLastName = x.Trainer.LastName }).ToList(); if (id != 0) { educationGroup = _educationGroupBLL.Get(id); } else { educationGroup = new EducationGroup(); } ViewBag.SelectStudentList = new MultiSelectList((from stu in _stuBLL.GetAll() join egs in _educationGroupStuBLL.GetAll() on stu.Id equals egs.StudentID join eg in _educationGroupBLL.GetAll() on egs.EducationGroupID equals eg.Id where (egs.EducationGroupID == educationGroup.Id && stu.EducationGrouoStatus == true)select new { ID = egs.StudentID, FullName = stu.FirstName + " " + stu.LastName }).Distinct(), "ID", "FullName", null); ViewBag.NotSelectStudentList = new MultiSelectList((from stu in _stuBLL.GetAll() where (stu.EducationGrouoStatus == false)select new { ID = stu.Id, FullName = stu.FirstName + " " + stu.LastName }).Distinct(), "ID", "FullName", null); return(View(educationGroup)); }
public ResultModel Get() { try { var resultQuery = _studentBLL.GetAll(); return(new ResultModel(Code.OK, resultQuery, resultQuery.Count(), "thành công")); } catch (Exception) { return(new ResultModel(Code.SVERROR, "lỗi hệ thống")); } }
public JArray GetAllSupervisor() { StudentBLL studentBLL = new StudentBLL(); var infos = studentBLL.GetAll().Where(item => item.IsSupervisor == 1); if (infos.Any()) { var _infos = infos.Select(item => new { title = item.UserInfo.LoginName, value = item.UserID }); return(JArray.Parse(JsonConvert.SerializeObject(_infos))); } return(new JArray()); }