public async Task <IActionResult> ViewOwner(int id, int?page) { //TODO: #1 implement a paginatedList for ViewOwner Action IList <decimal> total = new List <decimal>(); List <OwnerLoad> items = context .OwnerLoads .Include(item => item.Load) .Where(cm => cm.OwnerID == id) .ToList(); Owner owner = context.Owners.Single(m => m.ID == id); foreach (var item in items) { total.Add(item.Load.Amount); } ; ViewOwnerViewModel viewModel = new ViewOwnerViewModel { Owner = owner, Items = items, Total = total // Total = total }; int pageSize = 3; return(View((viewModel))); }
public async Task <IActionResult> ViewOwner(int id, int?page) { //TODO: #1 implement a paginatedList for ViewOwner Action List <OwnerLoad> items = context .OwnerLoads .Include(item => item.Load) .Where(cm => cm.OwnerID == id) .ToList(); Owner owner = context.Owners.Single(m => m.ID == id); ViewOwnerViewModel viewModel = new ViewOwnerViewModel { Owner = owner, Items = items }; int pageSize = 3; return(View((viewModel))); }