Пример #1
0
        public ActionResult List()
        {
            var vm = new Models.MoralGroup.List();

            using (var db = new XkSystem.Models.DbContext())
            {
                vm.MoralName = db.Table <Moral.Entity.tbMoral>().FirstOrDefault(d => d.Id == vm.MoralId).MoralName;
                var tb = from p in db.Table <Moral.Entity.tbMoralGroup>() where p.tbMoral.Id == vm.MoralId select p;
                if (!string.IsNullOrWhiteSpace(vm.SearchText))
                {
                    tb = tb.Where(p => p.MoralGroupName.Contains(vm.SearchText));
                }
                vm.MoralGroupList = (from p in tb
                                     orderby p.No
                                     select new Dto.MoralGroup.List()
                {
                    Id = p.Id,
                    No = p.No,
                    MoralGroupName = p.MoralGroupName,
                    MoralName = p.tbMoral.MoralName
                }).ToList();
            }
            return(View(vm));
        }
Пример #2
0
 public ActionResult List(Models.MoralGroup.List vm)
 {
     return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText, moralId = vm.MoralId })));
 }