コード例 #1
0
        public ActionResult List(int id = 0)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.StudentFamily.List();
                vm.StudentId = id;
                var tb = from p in db.Table <Student.Entity.tbStudentFamily>()
                         where p.tbStudent.Id == id
                         select p;

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

                vm.StudentFamilyList = (from p in tb
                                        orderby p.tbDictKinship.KinshipName
                                        select new Dto.StudentFamily.List
                {
                    Id = p.Id,
                    FamilyName = p.FamilyName,
                    EducationName = p.tbDictEducation.EducationName,
                    KinshipName = p.tbDictKinship.KinshipName,
                    UnitName = p.UnitName,
                    Job = p.Job,
                    Mobile = p.Mobile,
                }).ToList();

                return(PartialView(vm));
            }
        }
コード例 #2
0
 public ActionResult List(Models.StudentFamily.List vm)
 {
     return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText })));
 }