// // GET: /Project/Accounting/ public ActionResult Index(AccountingRequest request) { var model = new Accounting(); this.RenderMyViewData(model); //ViewData.Add("Rank", new SelectList(EnumHelper.GetItemValueList<EnumRank>(), "Key", "Value", model.Rank)); //ViewData.Add("AccountDep", new SelectList(EnumHelper.GetItemValueList<EnumDep>(), "Key", "Value", model.AccountDep)); var result = this.ProjectService.GetAccountingList(request); return View(result); }
public IEnumerable<Accounting> GetAccountingList(AccountingRequest request = null) { request = request ?? new AccountingRequest(); using (var dbContext = new ProjectDbContext()) { IQueryable<Accounting> Accounting = dbContext.Accountings; if (!string.IsNullOrEmpty(request.Name)) Accounting = Accounting.Where(u => u.Name.Contains(request.Name)); return Accounting.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize); } }