public IEnumerable<MachineryCost> GetMachineryCostList(MachineryCostRequest request = null) { request = request ?? new MachineryCostRequest(); using (var dbContext = new ProjectDbContext()) { IQueryable<MachineryCost> MachineryCost = dbContext.MachineryCosts; if (!string.IsNullOrEmpty(request.ProjectName)) MachineryCost = MachineryCost.Where(u => u.ProjectName.Contains(request.ProjectName)); return MachineryCost.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize); } }
public ActionResult Index(MachineryCostRequest request) { var result = this.ProjectService.GetMachineryCostList(request); return View(result); }