public ActionResult List()
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.ClassAllotClass.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();
                }

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

                vm.ClassAllotClassList = (from p in tb
                                          orderby p.No, p.ClassName
                                          select new Dto.ClassAllotClass.List
                {
                    Id = p.Id,
                    No = p.No,
                    ClassName = p.ClassName,
                    ClassTypeName = p.tbClassType.ClassTypeName,
                    GradeName = p.tbGrade.GradeName,
                    YearName = p.tbYear.YearName
                }).ToList();

                return(View(vm));
            }
        }
 public ActionResult List(Models.ClassAllotClass.List vm)
 {
     return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText, yearId = vm.YearId })));
 }