Exemple #1
0
        public async Task <HttpResponseMessage> Put(GetViewModel viewModel)
        {
            var user = UserManager.FindById(User.Identity.GetUserId());

            user.DisplayName = viewModel.DisplayName;
            user.Email       = viewModel.Email;

            await UserManager.UpdateAsync(user);

            return(Request.CreateResponse(HttpStatusCode.NoContent));
        }
        public async Task<HttpResponseMessage> Put(GetViewModel viewModel)
        {
            var user = UserManager.FindById(User.Identity.GetUserId());

            user.DisplayName = viewModel.DisplayName;
            user.Email = viewModel.Email;

            await UserManager.UpdateAsync(user);

            return Request.CreateResponse(HttpStatusCode.NoContent);
        }
        // GET api/Me
        public HttpResponseMessage Get()
        {
            var result = new GetViewModel();

            var user = UserManager.FindById(User.Identity.GetUserId());

            result.DisplayName = user.DisplayName;
            result.Picture = user.Picture;
            result.Id = user.Id;
            result.Email = user.Email;

            var logins = user.Logins;
            foreach (var login in logins)
            {
                if (login.LoginProvider == "Google")
                {
                    result.Google = login.ProviderKey;
                }
            }

            return Request.CreateResponse(HttpStatusCode.OK, result);
        }
Exemple #4
0
        // GET api/Me
        public HttpResponseMessage Get()
        {
            var result = new GetViewModel();

            var user = UserManager.FindById(User.Identity.GetUserId());

            result.DisplayName = user.DisplayName;
            result.Picture     = user.Picture;
            result.Id          = user.Id;
            result.Email       = user.Email;

            var logins = user.Logins;

            foreach (var login in logins)
            {
                if (login.LoginProvider == "Google")
                {
                    result.Google = login.ProviderKey;
                }
            }

            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }