public ActionResult List(Models.StudyRoomTeacher.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText, studyId = vm.StudyId, roomId = vm.RoomId }))); }
public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.StudyRoomTeacher.List(); vm.RoomName = db.Set <Basis.Entity.tbRoom>().Find(vm.RoomId).RoomName; vm.WeekList = Basis.Controllers.WeekController.SelectList(); var tb = from p in db.Table <Study.Entity.tbStudyRoomTeacher>() orderby p.tbRoom.No where p.tbStudy.Id == vm.StudyId && p.tbRoom.Id == vm.RoomId && p.tbRoom.IsDeleted == false && p.tbTeacher.IsDeleted == false && p.tbStudy.IsDeleted == false && p.tbWeek.IsDeleted == false select p; if (string.IsNullOrEmpty(vm.SearchText) == false) { tb = tb.Where(d => d.tbTeacher.TeacherCode.Contains(vm.SearchText) || d.tbTeacher.TeacherName.Contains(vm.SearchText)); } vm.StudyRoomTeacherList = (from p in tb orderby p.tbTeacher.TeacherName select new Dto.StudyRoomTeacher.List { Id = p.Id, RoomId = p.tbRoom.Id, RoomName = p.tbRoom.RoomName, IsMaster = p.IsMaster, TeacherId = p.tbTeacher.Id, TeacherCode = p.tbTeacher.TeacherCode, TeacherName = p.tbTeacher.TeacherName, WeekId = p.tbWeek.Id }).ToList(); return(View(vm)); } }