Example #1
0
        // GET: Conference
        public ActionResult Index()
        {
            List <ConferenceViewModel> model = new List <ConferenceViewModel>();
            var conferListId   = _conService.GetConferenceList();
            var listConference = _conService.GetConferList(conferListId);

            if (!User.IsInRole("secretary"))
            {
                var idString = User.Identity.GetUserId();
                var id       = _userService.GetUserIdByAspId(idString);

                if (conferListId != null)
                {
                    foreach (var item in listConference)
                    {
                        ConferenceViewModel confer = new ConferenceViewModel();
                        confer.Id            = item.Id;
                        confer.Thema         = item.Thema;
                        confer.Date          = Convert.ToDateTime(item.Date);
                        confer.Place         = item.Place;
                        confer.MembersStatus = _conService.CheckMemberInConference(id, item.Id);
                        model.Add(confer);
                    }
                }
                return(View(model));
            }

            else
            {
                if (conferListId != null)
                {
                    foreach (var item in listConference)
                    {
                        ConferenceViewModel confer = new ConferenceViewModel();
                        confer.Id            = item.Id;
                        confer.Thema         = item.Thema;
                        confer.Date          = Convert.ToDateTime(item.Date);
                        confer.Place         = item.Place;
                        confer.MembersStatus = true;
                        model.Add(confer);
                    }
                }
                return(View(model));
            }
        }