public ActionResult Invites() { int userID = WebSecurity.GetUserId(User.Identity.Name); UserProfile user = repository .Users .FirstOrDefault(u => u.UserId == userID); if (user == null) { logger.Warn("User with id = " + userID + " not found"); throw new HttpException(404, "User with id = " + userID + " not found"); } InvitesViewModel viewModel = new InvitesViewModel(); List <Team> invites = new List <Team>(); user.Teams.Each(t => { if (t.Confirm == 0) { invites.Add(new Team() { TeamID = t.TeamID, Name = t.Team.Name, Members = t.Team.Members }); } }); viewModel.Invites = invites; return(View(viewModel)); }
public InvitesPage() { InitializeComponent(); BindingContext = _vm = new InvitesViewModel(); }