Exemplo n.º 1
0
        public ActionResult List()
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.Period.List();
                var tb = from p in db.Table <Basis.Entity.tbPeriod>()
                         select p;

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

                vm.PeriodList = (from p in tb
                                 orderby p.No
                                 select new Dto.Period.List
                {
                    Id = p.Id,
                    No = p.No,
                    PeriodName = p.PeriodName
                }).ToList();
                return(View(vm));
            }
        }
Exemplo n.º 2
0
 public ActionResult List(Models.Period.List vm)
 {
     return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText })));
 }