// GET: Event public ActionResult Index() { EventService repo = new EventService(); EmployeeService emprepo = new EmployeeService(); InviteService repoInvite = new InviteService(); //-------------------------LIST DES EVENTS QUE L'USER A CREER------------------------------------// List <EventListItem> finallist = repo.GetByEmployeeId(UserSession.CurrentUser.Id).Select(e => new EventListItem(e, emprepo.Get(e.EmployeeId))).ToList(); //-------------------------LIST DES EVENTS AUQUEL L'USER EST INVITER------------------------------------// IEnumerable <Invite> invites = repoInvite.GetByEmployeeId(UserSession.CurrentUser.Id); List <EventInviteListItem> listInvite = new List <EventInviteListItem>(); foreach (Invite i in invites) { Event e = repo.Get(i.EventId); EventInviteListItem invite = new EventInviteListItem(e, emprepo.Get(e.EmployeeId), i); listInvite.Add(invite); } return(View(new EventIndex(finallist, listInvite))); }