void AppendCurrentIteration(IterationView iteration, List<int> projects, Func<CardView, bool> cardFilter) { var tasks = new Task<List<CardView>>[projects.Count]; for(var i = 0; i != projects.Count; ++i) { tasks[i] = CardsForCurrentIteration(projects[i]); } iteration.AddRange(tasks.SelectMany(x => x.Result).Where(cardFilter), x => x.CurrentState); }
public ActionResult CurrentIteration(int? id, string projects,string q) { var iteration = new IterationView { { "unstarted", new LaneView { Name = "Unstarted" } }, { "started", new LaneView { Name = "Started" } }, { "finished", new LaneView { Name = "Finished" } }, { "delivered", new LaneView { Name = "Delivered" } }, { "accepted", new LaneView { Name = "Done" } } }; var ids = new List<int>(); if(id.HasValue) ids.Add(id.Value); if(!string.IsNullOrEmpty(projects)) foreach(var item in projects.Split(' ')) ids.Add(int.Parse(item)); AppendCurrentIteration(iteration, ids, CreateCardFilter(q)); return View(iteration); }