Beispiel #1
0
        public IActionResult Index()
        {
            //Check to see if there is an AzureID in the session
            string userID = "";

            foreach (var claim in User.Claims)
            {
                if (claim.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier")
                {
                    userID = claim.Value;
                }
            }
            //No claim is available
            if (userID == "")
            {
                return(RedirectToAction("AccessDenied", "Account"));
            }
            else
            {
                //Fetch the members information from the database
                model.Member = _member.GetMember(userID);
                model.Seat   = _seatService.GetSeatByAzureID(userID);
                //Get the members attendance status from the register.  If it's 1 they can log in, else they can't
                int status = _memberRegister.GetMemberStatus(userID);
                if (status == 1)
                {
                    model.Registered  = 1;
                    model.CurrentVote = _vote.Get(model.Member, model.Ballot);
                }
                else
                {
                    model.Registered = status;
                }

                return(View(model));
            }
        }