Пример #1
0
        public ActionResult List()
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.ElectiveData.List();
                var tb = from p in db.Table <Entity.tbElectiveData>()
                         where p.tbElectiveOrg.tbElective.Id == 0
                         select p;

                if (string.IsNullOrEmpty(vm.SearchText) == false)
                {
                    tb = tb.Where(d => d.tbElectiveOrg.OrgName.Contains(vm.SearchText));
                }

                vm.ElectiveDataList = (from p in tb
                                       orderby p.InputDate descending
                                       select new Dto.ElectiveData.List
                {
                    Id = p.Id,
                    ElectiveOrgName = p.tbElectiveOrg.OrgName,
                    StudentName = p.tbStudent.StudentName,
                    IsFixed = p.IsFixed,
                    IsPreElective = p.IsPreElective
                }).ToList();
                return(View(vm));
            }
        }
Пример #2
0
 public ActionResult List(Models.ElectiveData.List vm)
 {
     return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText })));
 }