예제 #1
0
        public async Task <ActionResult> UserProfile()
        {
            string idsrvUserId = await IdSrvConnection.GetUserIdAsync(this.HttpContext);

            string userLogin = await IdSrvConnection.GetUserNameAsync(this.HttpContext);

            UserProfile userProfile = null;

            using (var context = new AccountsContext())
            {
                userProfile =
                    context.UserProfiles.Where(p => p.IdSrvId == idsrvUserId).FirstOrDefault() ??
                    context.UserProfiles.Where(p => p.Login == userLogin).FirstOrDefault();
            }

            if (userProfile == null)
            {
                return(this.HttpNotFound());
            }

            return(this.View(userProfile));
        }
예제 #2
0
        public async Task <ActionResult> AccessDenied()
        {
            string userName = await IdSrvConnection.GetUserNameAsync(this.HttpContext);

            return(this.View((object)userName));
        }