public ActionResult Index(InsMachineryCostRequest request) { var ProjectList = this.ProjectService.GetProjectBasedataList(new ProjectRequest()); this.ViewBag.ProjectBasedataID = new SelectList(ProjectList, "ID", "PName"); var result = this.ProjectService.GetInsMachineryCostList(request); return(View(result)); }
public IEnumerable <InsMachineryCost> GetInsMachineryCostList(InsMachineryCostRequest request = null) { request = request ?? new InsMachineryCostRequest(); using (var dbContext = new ProjectDbContext()) { IQueryable <InsMachineryCost> InsMachineryCost = dbContext.InsMachineryCosts.Include("ProjectBasedata"); if (request.ProjectBasedataID > 0) { InsMachineryCost = InsMachineryCost.Where(d => d.ProjectBasedataID == request.ProjectBasedataID); } return(InsMachineryCost.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize)); } }