public ActionResult Index(string hashTag) { HomeViewModel viewModel = new HomeViewModel(); var allAttendees = _repository.FindAll(); var selectAttendees = _repository.Find(new { Tags = hashTag }); // Buid the tag tree. There are, obviously, more graceful ways to do this - but we're in a rush here. Dictionary<string, int> keys = new Dictionary<string,int>(); foreach (var attendee in allAttendees) { foreach (var tag in attendee.Tags) { if (tag != null) { if (keys.ContainsKey(tag)) { keys[tag]++; } else { keys.Add(tag, 1); } } } } viewModel.Attendees = selectAttendees; viewModel.Hashtags = keys; return View(viewModel); }
public ViewResult SelectUsers(string hashTag) { HomeViewModel viewModel = new HomeViewModel(); var selectAttendees = _repository.Find(new { Tags = hashTag }); viewModel.Attendees = selectAttendees; return View("UserList", viewModel); }