コード例 #1
0
        public bool ChangeProfile(UserChangeProfile userChangeProfile)
        {
            using var unitOfWork = new UnitOfWork();
            var userRepo = unitOfWork.GetRepository <User>();
            var user     = userRepo.FirstOrDefault(x =>
                                                   x.Username == userChangeProfile.Username);

            if (user == null)
            {
                return(false);
            }
            user.FacebookId = userChangeProfile.FacebookId;
            user.GoogleId   = userChangeProfile.GoogleId;
            user.Email      = userChangeProfile.Email;
            user.UserType   = userChangeProfile.UserType;
            userRepo.Update(user);
            unitOfWork.Save();
            return(true);
        }
コード例 #2
0
        public IActionResult ChangeProfile([FromBody] UserChangeProfile userChangeProfile)
        {
            var loginResult = _userService.ChangeProfile(userChangeProfile);

            return(!loginResult?Unauthorized() as IActionResult : new OkObjectResult(true));
        }