// GET: Conference public ActionResult Index() { List <ConferenceIndexViewModel> model = new List <ConferenceIndexViewModel>(); var list = _conferencService.GetConfIndex(); if (!User.IsInRole("secretary")) { var userId = _userService.GetIdByAspId(User.Identity.GetUserId()); if (list != null) { foreach (var item in list) { ConferenceIndexViewModel confer = new ConferenceIndexViewModel(); confer.Id = item.Id; confer.Thema = item.Thema; confer.Date = Convert.ToDateTime(item.Date); confer.MemberConferenceStatus = _conferencService.UserIsMember(item.Id, userId); confer.ListenerConferenceStatus = _conferencService.UserIsListener(item.Id, userId); model.Add(confer); } } } else { if (list != null) { foreach (var item in list) { ConferenceIndexViewModel confer = new ConferenceIndexViewModel(); confer.Id = item.Id; confer.Thema = item.Thema; confer.Date = Convert.ToDateTime(item.Date); confer.MemberConferenceStatus = true; model.Add(confer); } } } return(View(model)); }