public ActionResult Edit(int id)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.ClassAllotResult.Edit();
                vm.ClassAllotClassList = ClassAllotClassController.SelectList(vm.YearId);

                vm.ClassAllotResultEdit = (from p in db.Table <Basis.Entity.tbClassAllotResult>()
                                           where p.Id == id
                                           select new Dto.ClassAllotResult.Edit
                {
                    Id = p.Id,
                    ClassAllotClassId = p.tbClassAllotClass.Id
                }).FirstOrDefault();
                return(View(vm));
            }
        }
        public ActionResult List()
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.ClassAllotResult.List();
                vm.YearList = YearController.SelectList(Code.EnumHelper.YearType.Year);
                if (vm.YearId == 0 && vm.YearList.Count > 0)
                {
                    vm.YearId = vm.YearList.OrderByDescending(d => d.Selected).FirstOrDefault().Value.ConvertToInt();
                }
                vm.ClassAllotClassList = ClassAllotClassController.SelectList(vm.YearId);

                var tb = from p in db.Table <Basis.Entity.tbClassAllotResult>()
                         where p.tbClassAllotClass.tbYear.Id == vm.YearId
                         select p;
                if (!string.IsNullOrEmpty(vm.SearchText))
                {
                    tb = tb.Where(d => d.tbStudent.StudentName.Contains(vm.SearchText) || d.tbStudent.StudentCode.Contains(vm.SearchText));
                }

                if (vm.ClassAllotClassId > 0)
                {
                    tb = tb.Where(d => d.tbClassAllotClass.Id == vm.ClassAllotClassId);
                }

                vm.ClassAllotResultList = (from p in tb
                                           select new Dto.ClassAllotResult.List
                {
                    Id = p.Id,
                    ClassName = p.tbClassAllotClass.ClassName,
                    ClassTypeName = p.tbClassAllotClass.tbClassType.ClassTypeName,
                    GradeName = p.tbClassAllotClass.tbGrade.GradeName,
                    StudentCode = p.tbStudent.StudentCode,
                    StudentName = p.tbStudent.StudentName,
                    SexName = p.tbStudent.tbSysUser.tbSex.SexName,
                    Score = p.Score
                }).ToList();
                return(View(vm));
            }
        }