public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.Quality.List(); vm.YearList = Basis.Controllers.YearController.SelectList(Code.EnumHelper.YearType.Section); if (vm.YearList.Count > 0 && vm.YearId == 0) { vm.YearId = vm.YearList.OrderByDescending(d => d.Selected).FirstOrDefault().Value.ConvertToInt(); } var tb = from p in db.Table <Quality.Entity.tbQuality>() where p.IsDeleted == false && p.tbYear.Id == vm.YearId select p; if (string.IsNullOrEmpty(vm.SearchText) == false) { tb = tb.Where(d => d.QualityName.Contains(vm.SearchText)); } vm.QualityList = (from p in tb orderby p.No select new Dto.Quality.List { Id = p.Id, No = p.No, QualityName = p.QualityName, FromDate = p.FromDate, IsOpen = p.IsOpen, ToDate = p.ToDate, YearName = p.tbYear.YearName, IsActive = p.IsActive, }).ToPageList(vm.Page); return(View(vm)); } }
public ActionResult List(Models.Quality.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { yearId = vm.YearId, searchText = vm.SearchText }))); }